@recast-navigation/core 0.4.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generators/generate-solo-nav-mesh.d.ts +1 -0
- package/dist/generators/generate-tiled-nav-mesh.d.ts +1 -0
- package/dist/index.es.js +2 -2
- package/dist/index.es.js.map +1 -1
- package/dist/nav-mesh-query.d.ts +36 -9
- package/dist/nav-mesh.d.ts +27 -40
- package/dist/raw.d.ts +10 -1
- package/dist/utils.d.ts +2 -1
- package/package.json +6 -6
package/dist/nav-mesh-query.d.ts
CHANGED
|
@@ -17,7 +17,10 @@ export declare class NavMeshQuery {
|
|
|
17
17
|
z: number;
|
|
18
18
|
};
|
|
19
19
|
constructor(value: R.NavMeshQuery | NavMeshQueryParams);
|
|
20
|
-
findNearestPoly(position: Vector3,
|
|
20
|
+
findNearestPoly(position: Vector3, options?: {
|
|
21
|
+
filter?: R.dtQueryFilter;
|
|
22
|
+
halfExtents?: Vector3;
|
|
23
|
+
}): {
|
|
21
24
|
status: number;
|
|
22
25
|
nearestRef: number;
|
|
23
26
|
nearestPoint: {
|
|
@@ -27,24 +30,48 @@ export declare class NavMeshQuery {
|
|
|
27
30
|
};
|
|
28
31
|
isOverPoly: boolean;
|
|
29
32
|
};
|
|
33
|
+
closestPointOnPoly(polyRef: number, position: Vector3): {
|
|
34
|
+
status: number;
|
|
35
|
+
closestPoint: {
|
|
36
|
+
x: number;
|
|
37
|
+
y: number;
|
|
38
|
+
z: number;
|
|
39
|
+
};
|
|
40
|
+
posOverPoly: boolean;
|
|
41
|
+
};
|
|
30
42
|
/**
|
|
31
43
|
* Returns the closest point on the NavMesh to the given position.
|
|
32
44
|
*/
|
|
33
|
-
getClosestPoint(position: Vector3,
|
|
45
|
+
getClosestPoint(position: Vector3, options?: {
|
|
46
|
+
filter?: R.dtQueryFilter;
|
|
47
|
+
}): Vector3;
|
|
34
48
|
/**
|
|
35
49
|
* Returns a random point on the NavMesh within the given radius of the given position.
|
|
36
50
|
*/
|
|
37
|
-
getRandomPointAround(position: Vector3, radius: number,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
51
|
+
getRandomPointAround(position: Vector3, radius: number, options?: {
|
|
52
|
+
filter?: R.dtQueryFilter;
|
|
53
|
+
}): Vector3;
|
|
54
|
+
moveAlongSurface(startRef: number, startPosition: Vector3, endPosition: Vector3, options?: {
|
|
55
|
+
filter?: R.dtQueryFilter;
|
|
56
|
+
maxVisitedSize?: number;
|
|
57
|
+
}): {
|
|
58
|
+
status: number;
|
|
59
|
+
resultPosition: {
|
|
60
|
+
x: number;
|
|
61
|
+
y: number;
|
|
62
|
+
z: number;
|
|
63
|
+
};
|
|
64
|
+
visited: number[];
|
|
65
|
+
};
|
|
42
66
|
/**
|
|
43
|
-
* Finds a path from the start position to the end position.
|
|
67
|
+
* Finds a straight path from the start position to the end position.
|
|
44
68
|
*
|
|
45
69
|
* @returns an array of Vector3 positions that make up the path, or an empty array if no path was found.
|
|
46
70
|
*/
|
|
47
|
-
computePath(start: Vector3, end: Vector3,
|
|
71
|
+
computePath(start: Vector3, end: Vector3, options?: {
|
|
72
|
+
filter?: R.dtQueryFilter;
|
|
73
|
+
maxPolyPathLength?: number;
|
|
74
|
+
}): Vector3[];
|
|
48
75
|
/**
|
|
49
76
|
* Destroys the NavMeshQuery instance
|
|
50
77
|
*/
|
package/dist/nav-mesh.d.ts
CHANGED
|
@@ -8,13 +8,6 @@ export declare class NavMeshGetTilesAtResult {
|
|
|
8
8
|
tileCount(): number;
|
|
9
9
|
destroy(): void;
|
|
10
10
|
}
|
|
11
|
-
export declare class NavMeshAddTileResult {
|
|
12
|
-
raw: R.NavMeshAddTileResult;
|
|
13
|
-
constructor(raw: R.NavMeshAddTileResult);
|
|
14
|
-
tileRef(): number;
|
|
15
|
-
status(): number;
|
|
16
|
-
destroy(): void;
|
|
17
|
-
}
|
|
18
11
|
export declare class NavMeshRemoveTileResult {
|
|
19
12
|
raw: R.NavMeshRemoveTileResult;
|
|
20
13
|
constructor(raw: R.NavMeshRemoveTileResult);
|
|
@@ -37,28 +30,6 @@ export declare class NavMeshGetTileAndPolyByRefResult {
|
|
|
37
30
|
status(): number;
|
|
38
31
|
destroy(): void;
|
|
39
32
|
}
|
|
40
|
-
export declare class NavMeshGetOffMeshConnectionPolyEndPointsResult {
|
|
41
|
-
raw: R.NavMeshGetOffMeshConnectionPolyEndPointsResult;
|
|
42
|
-
constructor(raw: R.NavMeshGetOffMeshConnectionPolyEndPointsResult);
|
|
43
|
-
status(): number;
|
|
44
|
-
startPos(): Vector3;
|
|
45
|
-
endPos(): Vector3;
|
|
46
|
-
destroy(): void;
|
|
47
|
-
}
|
|
48
|
-
export declare class NavMeshGetPolyFlagsResult {
|
|
49
|
-
raw: R.NavMeshGetPolyFlagsResult;
|
|
50
|
-
constructor(raw: R.NavMeshGetPolyFlagsResult);
|
|
51
|
-
flags(): number;
|
|
52
|
-
status(): number;
|
|
53
|
-
destroy(): void;
|
|
54
|
-
}
|
|
55
|
-
export declare class NavMeshGetPolyAreaResult {
|
|
56
|
-
raw: R.NavMeshGetPolyAreaResult;
|
|
57
|
-
constructor(raw: R.NavMeshGetPolyAreaResult);
|
|
58
|
-
area(): number;
|
|
59
|
-
status(): number;
|
|
60
|
-
destroy(): void;
|
|
61
|
-
}
|
|
62
33
|
export declare class NavMeshStoreTileStateResult {
|
|
63
34
|
raw: R.NavMeshStoreTileStateResult;
|
|
64
35
|
constructor(raw: R.NavMeshStoreTileStateResult);
|
|
@@ -66,11 +37,6 @@ export declare class NavMeshStoreTileStateResult {
|
|
|
66
37
|
dataSize(): number;
|
|
67
38
|
destroy(): void;
|
|
68
39
|
}
|
|
69
|
-
export declare class DebugNavMesh {
|
|
70
|
-
positions: number[];
|
|
71
|
-
indices: number[];
|
|
72
|
-
constructor(navMesh: NavMesh);
|
|
73
|
-
}
|
|
74
40
|
export type NavMeshParams = {
|
|
75
41
|
orig: Vector3;
|
|
76
42
|
tileWidth: number;
|
|
@@ -100,7 +66,10 @@ export declare class NavMesh {
|
|
|
100
66
|
* @param lastRef
|
|
101
67
|
* @returns the status of the operation and the reference of the added tile
|
|
102
68
|
*/
|
|
103
|
-
addTile(navMeshData: R.NavMeshData, flags: number, lastRef: number):
|
|
69
|
+
addTile(navMeshData: R.NavMeshData, flags: number, lastRef: number): {
|
|
70
|
+
status: number;
|
|
71
|
+
tileRef: number;
|
|
72
|
+
};
|
|
104
73
|
/**
|
|
105
74
|
* Removes a tile from the NavMesh
|
|
106
75
|
* @param ref the tile ref
|
|
@@ -188,7 +157,19 @@ export declare class NavMesh {
|
|
|
188
157
|
* @param polyRef The reference of the off-mesh connection polygon.
|
|
189
158
|
* @returns
|
|
190
159
|
*/
|
|
191
|
-
getOffMeshConnectionPolyEndPoints(prevRef: number, polyRef: number):
|
|
160
|
+
getOffMeshConnectionPolyEndPoints(prevRef: number, polyRef: number): {
|
|
161
|
+
status: number;
|
|
162
|
+
start: {
|
|
163
|
+
x: number;
|
|
164
|
+
y: number;
|
|
165
|
+
z: number;
|
|
166
|
+
};
|
|
167
|
+
end: {
|
|
168
|
+
x: number;
|
|
169
|
+
y: number;
|
|
170
|
+
z: number;
|
|
171
|
+
};
|
|
172
|
+
};
|
|
192
173
|
/**
|
|
193
174
|
* Gets the specified off-mesh connection.
|
|
194
175
|
* @param ref The polygon reference of the off-mesh connection.
|
|
@@ -206,7 +187,10 @@ export declare class NavMesh {
|
|
|
206
187
|
* @param ref The polygon reference.
|
|
207
188
|
* @returns
|
|
208
189
|
*/
|
|
209
|
-
getPolyFlags(ref: number):
|
|
190
|
+
getPolyFlags(ref: number): {
|
|
191
|
+
status: number;
|
|
192
|
+
flags: number;
|
|
193
|
+
};
|
|
210
194
|
/**
|
|
211
195
|
* Sets the user defined area for the specified polygon.
|
|
212
196
|
* @param ref The polygon reference.
|
|
@@ -218,7 +202,10 @@ export declare class NavMesh {
|
|
|
218
202
|
* @param ref The polygon reference.
|
|
219
203
|
* @returns
|
|
220
204
|
*/
|
|
221
|
-
getPolyArea(ref: number):
|
|
205
|
+
getPolyArea(ref: number): {
|
|
206
|
+
status: number;
|
|
207
|
+
area: number;
|
|
208
|
+
};
|
|
222
209
|
/**
|
|
223
210
|
* Gets the size of the buffer required by #storeTileState to store the specified tile's state.
|
|
224
211
|
* @param tile
|
|
@@ -241,9 +228,9 @@ export declare class NavMesh {
|
|
|
241
228
|
*/
|
|
242
229
|
restoreTileState(tile: DetourMeshTile, data: number[], maxDataSize: number): number;
|
|
243
230
|
/**
|
|
244
|
-
* Returns a
|
|
231
|
+
* Returns a triangle mesh that can be used to visualize the NavMesh.
|
|
245
232
|
*/
|
|
246
|
-
getDebugNavMesh():
|
|
233
|
+
getDebugNavMesh(): [positions: number[], indices: number[]];
|
|
247
234
|
/**
|
|
248
235
|
* Destroys the NavMesh.
|
|
249
236
|
*/
|
package/dist/raw.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import RawModule from './raw-module';
|
|
2
|
-
declare const arrays: readonly ["IntArray", "UnsignedCharArray", "UnsignedShortArray", "FloatArray"];
|
|
2
|
+
declare const arrays: readonly ["IntArray", "UnsignedIntArray", "UnsignedCharArray", "UnsignedShortArray", "FloatArray"];
|
|
3
3
|
/**
|
|
4
4
|
* Lower level bindings for the Recast and Detour libraries.
|
|
5
5
|
*
|
|
@@ -9,6 +9,7 @@ export declare const Raw: {
|
|
|
9
9
|
Module: typeof RawModule;
|
|
10
10
|
Arrays: {
|
|
11
11
|
IntArray: typeof RawModule.IntArray;
|
|
12
|
+
UnsignedIntArray: typeof RawModule.UnsignedIntArray;
|
|
12
13
|
UnsignedCharArray: typeof RawModule.UnsignedCharArray;
|
|
13
14
|
UnsignedShortArray: typeof RawModule.UnsignedShortArray;
|
|
14
15
|
FloatArray: typeof RawModule.FloatArray;
|
|
@@ -24,6 +25,8 @@ export declare const Raw: {
|
|
|
24
25
|
NavMeshExporter: RawModule.NavMeshExporter;
|
|
25
26
|
dtNavMeshCreateParams: typeof RawModule.dtNavMeshCreateParams;
|
|
26
27
|
dtNavMeshParams: typeof RawModule.dtNavMeshParams;
|
|
28
|
+
Vec3: typeof RawModule.Vec3;
|
|
29
|
+
Vec2: typeof RawModule.Vec2;
|
|
27
30
|
dtTileCacheParams: typeof RawModule.dtTileCacheParams;
|
|
28
31
|
RecastFastLZCompressor: typeof RawModule.RecastFastLZCompressor;
|
|
29
32
|
RecastLinearAllocator: typeof RawModule.RecastLinearAllocator;
|
|
@@ -31,6 +34,12 @@ export declare const Raw: {
|
|
|
31
34
|
dtTileCacheLayerHeader: typeof RawModule.dtTileCacheLayerHeader;
|
|
32
35
|
TileCacheData: typeof RawModule.TileCacheData;
|
|
33
36
|
rcChunkyTriMesh: typeof RawModule.rcChunkyTriMesh;
|
|
37
|
+
BoolRef: typeof RawModule.BoolRef;
|
|
38
|
+
IntRef: typeof RawModule.IntRef;
|
|
39
|
+
UnsignedIntRef: typeof RawModule.UnsignedIntRef;
|
|
40
|
+
UnsignedCharRef: typeof RawModule.UnsignedCharRef;
|
|
41
|
+
UnsignedShortRef: typeof RawModule.UnsignedShortRef;
|
|
42
|
+
FloatRef: typeof RawModule.FloatRef;
|
|
34
43
|
};
|
|
35
44
|
export declare const init: () => Promise<void>;
|
|
36
45
|
export {};
|
package/dist/utils.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export type Vector3 = {
|
|
|
4
4
|
y: number;
|
|
5
5
|
z: number;
|
|
6
6
|
};
|
|
7
|
+
export type Vector3Tuple = [number, number, number];
|
|
7
8
|
export declare const vec3: {
|
|
8
9
|
toRaw: ({ x, y, z }: Vector3, existing?: R.Vec3) => R.Vec3;
|
|
9
10
|
fromRaw: (vec3: R.Vec3, freeRaw?: boolean) => {
|
|
@@ -16,6 +17,6 @@ export declare const vec3: {
|
|
|
16
17
|
y: number;
|
|
17
18
|
z: number;
|
|
18
19
|
};
|
|
19
|
-
toArray: ({ x, y, z }: Vector3) =>
|
|
20
|
+
toArray: ({ x, y, z }: Vector3) => Vector3Tuple;
|
|
20
21
|
};
|
|
21
22
|
export declare const array: <T>(getter: (index: number) => T, count: number) => T[];
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"email": "isaac@isaacmason.com",
|
|
7
7
|
"url": "https://isaacmason.com/"
|
|
8
8
|
},
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.6.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"homepage": "https://github.com/isaac-mason/recast-navigation-js",
|
|
12
12
|
"bugs": {
|
|
@@ -25,17 +25,17 @@
|
|
|
25
25
|
"test": "vitest run"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@recast-navigation/wasm": "0.
|
|
28
|
+
"@recast-navigation/wasm": "0.6.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@babel/core": "^7.22.
|
|
31
|
+
"@babel/core": "^7.22.11",
|
|
32
32
|
"@rollup/plugin-commonjs": "^24.0.1",
|
|
33
33
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
34
34
|
"@rollup/plugin-terser": "^0.4.3",
|
|
35
35
|
"@rollup/plugin-typescript": "^11.1.2",
|
|
36
36
|
"@types/three": "^0.155.0",
|
|
37
37
|
"@typescript-eslint/eslint-plugin": "^5.7.0",
|
|
38
|
-
"@typescript-eslint/parser": "^
|
|
38
|
+
"@typescript-eslint/parser": "^6.4.1",
|
|
39
39
|
"babel-loader": "^8.2.5",
|
|
40
40
|
"eslint": "^8.5.0",
|
|
41
41
|
"eslint-config-airbnb": "^18.2.1",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"eslint-import-resolver-typescript": "^3.5.5",
|
|
45
45
|
"eslint-plugin-es": "^4.1.0",
|
|
46
46
|
"eslint-plugin-import": "^2.28.0",
|
|
47
|
-
"eslint-plugin-prettier": "^
|
|
47
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
48
48
|
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
49
49
|
"eslint-plugin-typescript-enum": "^2.1.0",
|
|
50
50
|
"prettier": "^3.0.2",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"rollup-plugin-copy": "^3.4.0",
|
|
53
53
|
"rollup-plugin-filesize": "^10.0.0",
|
|
54
54
|
"typescript": "^5.1.6",
|
|
55
|
-
"vitest": "^0.
|
|
55
|
+
"vitest": "^0.34.3"
|
|
56
56
|
},
|
|
57
57
|
"packageManager": "yarn@3.2.1"
|
|
58
58
|
}
|