@recast-navigation/core 0.4.1 → 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.
@@ -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, halfExtents: Vector3, filter?: R.dtQueryFilter): {
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, filter?: R.dtQueryFilter): 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, filter?: R.dtQueryFilter): Vector3;
38
- /**
39
- * Compute the final position from a segment made of destination-position
40
- */
41
- moveAlong(position: Vector3, destination: Vector3, filter?: R.dtQueryFilter): Vector3;
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, filter?: R.dtQueryFilter): 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
  */
@@ -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): NavMeshAddTileResult;
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): NavMeshGetOffMeshConnectionPolyEndPointsResult;
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): NavMeshGetPolyFlagsResult;
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): NavMeshGetPolyAreaResult;
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,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) => number[];
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.4.1",
9
+ "version": "0.5.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.4.1"
28
+ "@recast-navigation/wasm": "0.5.0"
29
29
  },
30
30
  "devDependencies": {
31
- "@babel/core": "^7.22.5",
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": "^5.60.1",
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": "^4.0.0",
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.33.0"
55
+ "vitest": "^0.34.3"
56
56
  },
57
57
  "packageManager": "yarn@3.2.1"
58
58
  }