@recast-navigation/core 0.4.0 → 0.5.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/crowd.d.ts +1 -1
- package/dist/detour.d.ts +1 -1
- package/dist/generators/generate-solo-nav-mesh.d.ts +1 -0
- package/dist/generators/generate-tiled-nav-mesh.d.ts +3 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +2 -2
- package/dist/index.es.js.map +1 -1
- package/dist/nav-mesh-query.d.ts +37 -10
- package/dist/nav-mesh.d.ts +27 -35
- package/dist/raw-module.d.ts +2 -0
- package/dist/raw.d.ts +38 -16
- package/dist/recast.d.ts +1 -1
- package/dist/serdes/import-nav-mesh.d.ts +1 -1
- package/dist/tile-cache.d.ts +1 -1
- package/dist/utils.d.ts +3 -2
- package/package.json +9 -7
package/dist/nav-mesh-query.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type R from '@recast-navigation/wasm';
|
|
2
1
|
import { NavMesh } from './nav-mesh';
|
|
2
|
+
import type R from './raw-module';
|
|
3
3
|
import { Vector3 } from './utils';
|
|
4
4
|
export type NavMeshQueryParams = {
|
|
5
5
|
navMesh: NavMesh;
|
|
@@ -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
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { DetourMeshTile, DetourOffMeshConnection, dtPoly } from './detour';
|
|
2
|
+
import type R from './raw-module';
|
|
2
3
|
import { Vector3 } from './utils';
|
|
3
|
-
import { DetourMeshTile, dtPoly, DetourOffMeshConnection } from './detour';
|
|
4
4
|
export declare class NavMeshGetTilesAtResult {
|
|
5
5
|
raw: R.NavMeshGetTilesAtResult;
|
|
6
6
|
constructor(raw: R.NavMeshGetTilesAtResult);
|
|
@@ -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);
|
|
@@ -100,7 +71,10 @@ export declare class NavMesh {
|
|
|
100
71
|
* @param lastRef
|
|
101
72
|
* @returns the status of the operation and the reference of the added tile
|
|
102
73
|
*/
|
|
103
|
-
addTile(navMeshData: R.NavMeshData, flags: number, lastRef: number):
|
|
74
|
+
addTile(navMeshData: R.NavMeshData, flags: number, lastRef: number): {
|
|
75
|
+
status: number;
|
|
76
|
+
tileRef: number;
|
|
77
|
+
};
|
|
104
78
|
/**
|
|
105
79
|
* Removes a tile from the NavMesh
|
|
106
80
|
* @param ref the tile ref
|
|
@@ -188,7 +162,19 @@ export declare class NavMesh {
|
|
|
188
162
|
* @param polyRef The reference of the off-mesh connection polygon.
|
|
189
163
|
* @returns
|
|
190
164
|
*/
|
|
191
|
-
getOffMeshConnectionPolyEndPoints(prevRef: number, polyRef: number):
|
|
165
|
+
getOffMeshConnectionPolyEndPoints(prevRef: number, polyRef: number): {
|
|
166
|
+
status: number;
|
|
167
|
+
start: {
|
|
168
|
+
x: number;
|
|
169
|
+
y: number;
|
|
170
|
+
z: number;
|
|
171
|
+
};
|
|
172
|
+
end: {
|
|
173
|
+
x: number;
|
|
174
|
+
y: number;
|
|
175
|
+
z: number;
|
|
176
|
+
};
|
|
177
|
+
};
|
|
192
178
|
/**
|
|
193
179
|
* Gets the specified off-mesh connection.
|
|
194
180
|
* @param ref The polygon reference of the off-mesh connection.
|
|
@@ -206,7 +192,10 @@ export declare class NavMesh {
|
|
|
206
192
|
* @param ref The polygon reference.
|
|
207
193
|
* @returns
|
|
208
194
|
*/
|
|
209
|
-
getPolyFlags(ref: number):
|
|
195
|
+
getPolyFlags(ref: number): {
|
|
196
|
+
status: number;
|
|
197
|
+
flags: number;
|
|
198
|
+
};
|
|
210
199
|
/**
|
|
211
200
|
* Sets the user defined area for the specified polygon.
|
|
212
201
|
* @param ref The polygon reference.
|
|
@@ -218,7 +207,10 @@ export declare class NavMesh {
|
|
|
218
207
|
* @param ref The polygon reference.
|
|
219
208
|
* @returns
|
|
220
209
|
*/
|
|
221
|
-
getPolyArea(ref: number):
|
|
210
|
+
getPolyArea(ref: number): {
|
|
211
|
+
status: number;
|
|
212
|
+
area: number;
|
|
213
|
+
};
|
|
222
214
|
/**
|
|
223
215
|
* Gets the size of the buffer required by #storeTileState to store the specified tile's state.
|
|
224
216
|
* @param tile
|
package/dist/raw.d.ts
CHANGED
|
@@ -1,23 +1,45 @@
|
|
|
1
|
-
import
|
|
2
|
-
declare const
|
|
3
|
-
declare const classes: readonly ["rcContext", "dtNavMeshParams", "dtNavMeshCreateParams", "RecastLinearAllocator", "RecastFastLZCompressor", "rcChunkyTriMesh", "TileCacheData", "dtTileCacheParams", "dtTileCacheLayerHeader"];
|
|
4
|
-
declare const arrays: readonly ["IntArray", "UnsignedCharArray", "UnsignedShortArray", "FloatArray"];
|
|
5
|
-
type RawType = {
|
|
6
|
-
Module: typeof Module;
|
|
7
|
-
Arrays: {
|
|
8
|
-
[K in typeof arrays[number]]: typeof Module[K];
|
|
9
|
-
};
|
|
10
|
-
isNull: (obj: unknown) => boolean;
|
|
11
|
-
} & {
|
|
12
|
-
[K in typeof instances[number]]: InstanceType<typeof Module[K]>;
|
|
13
|
-
} & {
|
|
14
|
-
[K in typeof classes[number]]: typeof Module[K];
|
|
15
|
-
};
|
|
1
|
+
import RawModule from './raw-module';
|
|
2
|
+
declare const arrays: readonly ["IntArray", "UnsignedIntArray", "UnsignedCharArray", "UnsignedShortArray", "FloatArray"];
|
|
16
3
|
/**
|
|
17
4
|
* Lower level bindings for the Recast and Detour libraries.
|
|
18
5
|
*
|
|
19
6
|
* The `init` function must be called before using the `Raw` api.
|
|
20
7
|
*/
|
|
21
|
-
export declare const Raw:
|
|
8
|
+
export declare const Raw: {
|
|
9
|
+
Module: typeof RawModule;
|
|
10
|
+
Arrays: {
|
|
11
|
+
IntArray: typeof RawModule.IntArray;
|
|
12
|
+
UnsignedIntArray: typeof RawModule.UnsignedIntArray;
|
|
13
|
+
UnsignedCharArray: typeof RawModule.UnsignedCharArray;
|
|
14
|
+
UnsignedShortArray: typeof RawModule.UnsignedShortArray;
|
|
15
|
+
FloatArray: typeof RawModule.FloatArray;
|
|
16
|
+
};
|
|
17
|
+
isNull: (obj: unknown) => boolean;
|
|
18
|
+
CrowdUtils: RawModule.CrowdUtils;
|
|
19
|
+
Detour: RawModule.Detour;
|
|
20
|
+
Recast: RawModule.Recast;
|
|
21
|
+
DetourNavMeshBuilder: RawModule.DetourNavMeshBuilder;
|
|
22
|
+
DetourTileCacheBuilder: RawModule.DetourTileCacheBuilder;
|
|
23
|
+
ChunkyTriMesh: RawModule.ChunkyTriMesh;
|
|
24
|
+
NavMeshImporter: RawModule.NavMeshImporter;
|
|
25
|
+
NavMeshExporter: RawModule.NavMeshExporter;
|
|
26
|
+
dtNavMeshCreateParams: typeof RawModule.dtNavMeshCreateParams;
|
|
27
|
+
dtNavMeshParams: typeof RawModule.dtNavMeshParams;
|
|
28
|
+
Vec3: typeof RawModule.Vec3;
|
|
29
|
+
Vec2: typeof RawModule.Vec2;
|
|
30
|
+
dtTileCacheParams: typeof RawModule.dtTileCacheParams;
|
|
31
|
+
RecastFastLZCompressor: typeof RawModule.RecastFastLZCompressor;
|
|
32
|
+
RecastLinearAllocator: typeof RawModule.RecastLinearAllocator;
|
|
33
|
+
rcContext: typeof RawModule.rcContext;
|
|
34
|
+
dtTileCacheLayerHeader: typeof RawModule.dtTileCacheLayerHeader;
|
|
35
|
+
TileCacheData: typeof RawModule.TileCacheData;
|
|
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;
|
|
43
|
+
};
|
|
22
44
|
export declare const init: () => Promise<void>;
|
|
23
45
|
export {};
|
package/dist/recast.d.ts
CHANGED
package/dist/tile-cache.d.ts
CHANGED
package/dist/utils.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type R from '
|
|
1
|
+
import type R from './raw-module';
|
|
2
2
|
export type Vector3 = {
|
|
3
3
|
x: number;
|
|
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.5.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"homepage": "https://github.com/isaac-mason/recast-navigation-js",
|
|
12
12
|
"bugs": {
|
|
@@ -24,16 +24,18 @@
|
|
|
24
24
|
"build": "rollup --config rollup.config.js --bundleConfigAsCjs",
|
|
25
25
|
"test": "vitest run"
|
|
26
26
|
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@recast-navigation/wasm": "0.5.0"
|
|
29
|
+
},
|
|
27
30
|
"devDependencies": {
|
|
28
|
-
"@babel/core": "^7.22.
|
|
29
|
-
"@recast-navigation/wasm": "0.4.0",
|
|
31
|
+
"@babel/core": "^7.22.11",
|
|
30
32
|
"@rollup/plugin-commonjs": "^24.0.1",
|
|
31
33
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
32
34
|
"@rollup/plugin-terser": "^0.4.3",
|
|
33
35
|
"@rollup/plugin-typescript": "^11.1.2",
|
|
34
36
|
"@types/three": "^0.155.0",
|
|
35
37
|
"@typescript-eslint/eslint-plugin": "^5.7.0",
|
|
36
|
-
"@typescript-eslint/parser": "^
|
|
38
|
+
"@typescript-eslint/parser": "^6.4.1",
|
|
37
39
|
"babel-loader": "^8.2.5",
|
|
38
40
|
"eslint": "^8.5.0",
|
|
39
41
|
"eslint-config-airbnb": "^18.2.1",
|
|
@@ -42,15 +44,15 @@
|
|
|
42
44
|
"eslint-import-resolver-typescript": "^3.5.5",
|
|
43
45
|
"eslint-plugin-es": "^4.1.0",
|
|
44
46
|
"eslint-plugin-import": "^2.28.0",
|
|
45
|
-
"eslint-plugin-prettier": "^
|
|
47
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
46
48
|
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
47
49
|
"eslint-plugin-typescript-enum": "^2.1.0",
|
|
48
|
-
"prettier": "^
|
|
50
|
+
"prettier": "^3.0.2",
|
|
49
51
|
"rollup": "^3.26.3",
|
|
50
52
|
"rollup-plugin-copy": "^3.4.0",
|
|
51
53
|
"rollup-plugin-filesize": "^10.0.0",
|
|
52
54
|
"typescript": "^5.1.6",
|
|
53
|
-
"vitest": "^0.
|
|
55
|
+
"vitest": "^0.34.3"
|
|
54
56
|
},
|
|
55
57
|
"packageManager": "yarn@3.2.1"
|
|
56
58
|
}
|