@recast-navigation/core 0.0.6 → 0.1.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 +2 -2
- package/dist/dt-status.d.ts +18 -0
- package/dist/index.d.ts +8 -2
- package/dist/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/dist/nav-mesh-builder.d.ts +40 -0
- package/dist/nav-mesh-exporter.d.ts +12 -0
- package/dist/nav-mesh-generator.d.ts +116 -0
- package/dist/nav-mesh-importer.d.ts +16 -0
- package/dist/nav-mesh-query.d.ts +46 -0
- package/dist/nav-mesh.d.ts +279 -125
- package/dist/tile-cache.d.ts +48 -0
- package/dist/utils.d.ts +8 -5
- package/dist/{raw.d.ts → wasm.d.ts} +2 -1
- package/package.json +2 -2
- package/dist/debug-nav-mesh.d.ts +0 -7
package/dist/nav-mesh.d.ts
CHANGED
|
@@ -1,181 +1,335 @@
|
|
|
1
1
|
import type R from '@recast-navigation/wasm';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
2
|
+
import { Vector3 } from './utils';
|
|
3
|
+
export declare class dtPoly {
|
|
4
|
+
raw: R.dtPoly;
|
|
5
|
+
constructor(raw: R.dtPoly);
|
|
6
|
+
firstLink(): number;
|
|
7
|
+
verts(index: number): number;
|
|
8
|
+
neis(index: number): number;
|
|
9
|
+
flags(): number;
|
|
10
|
+
vertCount(): number;
|
|
11
|
+
areaAndType(): number;
|
|
12
|
+
getType(): number;
|
|
13
|
+
}
|
|
14
|
+
export declare class dtPolyDetail {
|
|
15
|
+
raw: R.dtPolyDetail;
|
|
16
|
+
constructor(raw: R.dtPolyDetail);
|
|
17
|
+
vertBase(): number;
|
|
18
|
+
triBase(): number;
|
|
19
|
+
vertCount(): number;
|
|
20
|
+
triCount(): number;
|
|
21
|
+
}
|
|
22
|
+
export declare class dtLink {
|
|
23
|
+
raw: R.dtLink;
|
|
24
|
+
constructor(raw: R.dtLink);
|
|
25
|
+
ref(): number;
|
|
26
|
+
next(): number;
|
|
27
|
+
edge(): number;
|
|
28
|
+
side(): number;
|
|
29
|
+
bmin(): number;
|
|
30
|
+
bmax(): number;
|
|
31
|
+
}
|
|
32
|
+
export declare class dtBVNode {
|
|
33
|
+
raw: R.dtBVNode;
|
|
34
|
+
constructor(raw: R.dtBVNode);
|
|
35
|
+
bmin(): Vector3;
|
|
36
|
+
bmax(): Vector3;
|
|
37
|
+
i(): number;
|
|
38
|
+
}
|
|
39
|
+
export declare class dtOffMeshConnection {
|
|
40
|
+
raw: R.dtOffMeshConnection;
|
|
41
|
+
constructor(raw: R.dtOffMeshConnection);
|
|
42
|
+
pos(index: number): number;
|
|
43
|
+
rad(): number;
|
|
44
|
+
poly(): number;
|
|
45
|
+
flags(): number;
|
|
46
|
+
side(): number;
|
|
47
|
+
userId(): number;
|
|
48
|
+
}
|
|
49
|
+
export declare class dtMeshHeader {
|
|
50
|
+
raw: R.dtMeshHeader;
|
|
51
|
+
constructor(raw: R.dtMeshHeader);
|
|
52
|
+
magic(): number;
|
|
53
|
+
version(): number;
|
|
54
|
+
x(): number;
|
|
55
|
+
y(): number;
|
|
56
|
+
layer(): number;
|
|
57
|
+
userId(): number;
|
|
58
|
+
polyCount(): number;
|
|
59
|
+
vertCount(): number;
|
|
60
|
+
maxLinkCount(): number;
|
|
61
|
+
detailMeshCount(): number;
|
|
62
|
+
detailVertCount(): number;
|
|
63
|
+
detailTriCount(): number;
|
|
64
|
+
bvNodeCount(): number;
|
|
65
|
+
offMeshConCount(): number;
|
|
66
|
+
offMeshBase(): number;
|
|
67
|
+
walkableHeight(): number;
|
|
68
|
+
walkableRadius(): number;
|
|
69
|
+
walkableClimb(): number;
|
|
70
|
+
bmin(index: number): number;
|
|
71
|
+
bmax(index: number): number;
|
|
72
|
+
bvQuantFactor(): number;
|
|
73
|
+
}
|
|
74
|
+
export declare class dtMeshTile {
|
|
75
|
+
raw: R.dtMeshTile;
|
|
76
|
+
constructor(raw: R.dtMeshTile);
|
|
77
|
+
salt(): number;
|
|
78
|
+
linksFreeList(): number;
|
|
79
|
+
header(): dtMeshHeader | null;
|
|
80
|
+
polys(index: number): dtPoly;
|
|
81
|
+
verts(index: number): number;
|
|
82
|
+
links(index: number): dtLink;
|
|
83
|
+
detailMeshes(index: number): dtPolyDetail;
|
|
84
|
+
detailVerts(index: number): number;
|
|
85
|
+
detailTris(index: number): number;
|
|
86
|
+
bvTree(index: number): dtBVNode;
|
|
87
|
+
offMeshCons(index: number): dtOffMeshConnection;
|
|
88
|
+
data(index: number): number;
|
|
89
|
+
dataSize(): number;
|
|
90
|
+
flags(): number;
|
|
91
|
+
next(): dtMeshTile;
|
|
92
|
+
}
|
|
93
|
+
export declare class NavMeshGetTilesAtResult {
|
|
94
|
+
raw: R.NavMeshGetTilesAtResult;
|
|
95
|
+
constructor(raw: R.NavMeshGetTilesAtResult);
|
|
96
|
+
tiles(index: number): dtMeshTile;
|
|
97
|
+
tileCount(): number;
|
|
98
|
+
}
|
|
99
|
+
export declare class NavMeshAddTileResult {
|
|
100
|
+
raw: R.NavMeshAddTileResult;
|
|
101
|
+
constructor(raw: R.NavMeshAddTileResult);
|
|
102
|
+
tileRef(): number;
|
|
103
|
+
status(): number;
|
|
104
|
+
}
|
|
105
|
+
export declare class NavMeshRemoveTileResult {
|
|
106
|
+
raw: R.NavMeshRemoveTileResult;
|
|
107
|
+
constructor(raw: R.NavMeshRemoveTileResult);
|
|
108
|
+
data(): number[];
|
|
109
|
+
dataSize(): number;
|
|
110
|
+
}
|
|
111
|
+
export declare class NavMeshCalcTileLocResult {
|
|
112
|
+
raw: R.NavMeshCalcTileLocResult;
|
|
113
|
+
constructor(raw: R.NavMeshCalcTileLocResult);
|
|
114
|
+
tileX(): number;
|
|
115
|
+
tileY(): number;
|
|
116
|
+
}
|
|
117
|
+
export declare class NavMeshGetTileAndPolyByRefResult {
|
|
118
|
+
raw: R.NavMeshGetTileAndPolyByRefResult;
|
|
119
|
+
constructor(raw: R.NavMeshGetTileAndPolyByRefResult);
|
|
120
|
+
tile(): dtMeshTile;
|
|
121
|
+
poly(): dtPoly;
|
|
122
|
+
status(): number;
|
|
123
|
+
}
|
|
124
|
+
export declare class NavMeshGetOffMeshConnectionPolyEndPointsResult {
|
|
125
|
+
raw: R.NavMeshGetOffMeshConnectionPolyEndPointsResult;
|
|
126
|
+
constructor(raw: R.NavMeshGetOffMeshConnectionPolyEndPointsResult);
|
|
127
|
+
status(): number;
|
|
128
|
+
startPos(): Vector3;
|
|
129
|
+
endPos(): Vector3;
|
|
130
|
+
}
|
|
131
|
+
export declare class NavMeshGetPolyFlagsResult {
|
|
132
|
+
raw: R.NavMeshGetPolyFlagsResult;
|
|
133
|
+
constructor(raw: R.NavMeshGetPolyFlagsResult);
|
|
134
|
+
flags(): number;
|
|
135
|
+
status(): number;
|
|
136
|
+
}
|
|
137
|
+
export declare class NavMeshGetPolyAreaResult {
|
|
138
|
+
raw: R.NavMeshGetPolyAreaResult;
|
|
139
|
+
constructor(raw: R.NavMeshGetPolyAreaResult);
|
|
140
|
+
area(): number;
|
|
141
|
+
status(): number;
|
|
142
|
+
}
|
|
143
|
+
export declare class NavMeshStoreTileStateResult {
|
|
144
|
+
raw: R.NavMeshStoreTileStateResult;
|
|
145
|
+
constructor(raw: R.NavMeshStoreTileStateResult);
|
|
146
|
+
data(): number[];
|
|
147
|
+
dataSize(): number;
|
|
148
|
+
}
|
|
149
|
+
export declare class DebugNavMesh {
|
|
150
|
+
raw: R.DebugNavMesh;
|
|
151
|
+
positions: number[];
|
|
152
|
+
indices: number[];
|
|
153
|
+
constructor(debugNavMesh: R.DebugNavMesh);
|
|
154
|
+
}
|
|
155
|
+
export declare type NavMeshParams = {
|
|
156
|
+
orig: Vector3;
|
|
157
|
+
tileWidth: number;
|
|
158
|
+
tileHeight: number;
|
|
159
|
+
maxTiles: number;
|
|
160
|
+
maxPolys: number;
|
|
161
|
+
};
|
|
162
|
+
export declare class NavMesh {
|
|
163
|
+
raw: R.NavMesh;
|
|
164
|
+
constructor(raw?: R.NavMesh);
|
|
30
165
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* @
|
|
166
|
+
* Initializes the NavMesh for use with a single tile.
|
|
167
|
+
* @param data the nav mesh data
|
|
168
|
+
* @param dataSize the size of the nav mesh data
|
|
169
|
+
* @param flags the flags to use when building the nav mesh
|
|
170
|
+
* @returns the status of the operation
|
|
34
171
|
*/
|
|
35
|
-
|
|
172
|
+
initSolo(data: ReadonlyArray<number>, dataSize: number, flags: number): boolean;
|
|
36
173
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* @
|
|
174
|
+
* Initializes the NavMesh for use with multiple tiles.
|
|
175
|
+
* @param params parameters for the NavMesh
|
|
176
|
+
* @returns the status of the operation
|
|
40
177
|
*/
|
|
41
|
-
|
|
178
|
+
initTiled({ orig, tileWidth, tileHeight, maxTiles, maxPolys, }: NavMeshParams): boolean;
|
|
42
179
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* @
|
|
180
|
+
* Adds a tile to the NavMesh.
|
|
181
|
+
* @param data the nav mesh data
|
|
182
|
+
* @param dataSize the size of the nav mesh data
|
|
183
|
+
* @param flags the flags to use when building the nav mesh
|
|
184
|
+
* @param lastRef
|
|
185
|
+
* @returns the status of the operation and the reference of the added tile
|
|
46
186
|
*/
|
|
47
|
-
|
|
187
|
+
addTile(data: number[], dataSize: number, flags: number, lastRef: number): NavMeshAddTileResult;
|
|
48
188
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* @
|
|
189
|
+
* Removes a tile from the NavMesh
|
|
190
|
+
* @param ref the tile ref
|
|
191
|
+
* @returns the nav mesh data, so it can be added back later
|
|
52
192
|
*/
|
|
53
|
-
|
|
193
|
+
removeTile(ref: number): NavMeshRemoveTileResult;
|
|
54
194
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* @
|
|
195
|
+
* Calculates the tile grid location for the specified world position.
|
|
196
|
+
* @param pos The world position for the query. [(x, y, z)]
|
|
197
|
+
* @returns
|
|
58
198
|
*/
|
|
59
|
-
|
|
199
|
+
calcTileLoc(pos: Vector3): NavMeshCalcTileLocResult;
|
|
60
200
|
/**
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* @
|
|
201
|
+
* Gets the tile at the specified grid location.
|
|
202
|
+
* @param x The tile's x-location. (x, y, layer)
|
|
203
|
+
* @param y The tile's y-location. (x, y, layer)
|
|
204
|
+
* @param layer The tile's layer. (x, y, layer)
|
|
205
|
+
* @returns The tile, or null if the tile does not exist.
|
|
64
206
|
*/
|
|
65
|
-
|
|
207
|
+
getTileAt(x: number, y: number, layer: number): dtMeshTile | null;
|
|
66
208
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* @
|
|
209
|
+
* Gets all tiles at the specified grid location. (All layers.)
|
|
210
|
+
* @param x The tile's x-location. (x, y)
|
|
211
|
+
* @param y The tile's y-location. (x, y)
|
|
212
|
+
* @param maxTiles The maximum tiles the tiles parameter can hold.
|
|
70
213
|
*/
|
|
71
|
-
|
|
214
|
+
getTilesAt(x: number, y: number, maxTiles: number): NavMeshGetTilesAtResult;
|
|
72
215
|
/**
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* @
|
|
216
|
+
* Gets the tile reference for the tile at specified grid location.
|
|
217
|
+
* @param x The tile's x-location. (x, y, layer)
|
|
218
|
+
* @param y The tile's y-location. (x, y, layer)
|
|
219
|
+
* @param layer The tile's layer. (x, y, layer)
|
|
220
|
+
* @returns The tile reference of the tile, or 0 if there is none.
|
|
76
221
|
*/
|
|
77
|
-
|
|
222
|
+
getTileRefAt(x: number, y: number, layer: number): number;
|
|
78
223
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
* @
|
|
224
|
+
* Gets the tile reference for the specified tile.
|
|
225
|
+
* @param tile
|
|
226
|
+
* @returns
|
|
82
227
|
*/
|
|
83
|
-
|
|
228
|
+
getTileRef(tile: dtMeshTile): number;
|
|
84
229
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* @
|
|
230
|
+
* Gets the tile for the specified tile reference.
|
|
231
|
+
* @param ref The tile reference of the tile to retrieve.
|
|
232
|
+
* @returns The tile for the specified reference, or null if the reference is invalid.
|
|
88
233
|
*/
|
|
89
|
-
|
|
234
|
+
getTileByRef(ref: number): dtMeshTile | null;
|
|
90
235
|
/**
|
|
91
|
-
*
|
|
92
|
-
* [Limits: 0 or >= 0.9] [Units: wu]
|
|
93
|
-
* @default 6
|
|
236
|
+
* Returns the maximum number of tiles supported by the navigation mesh.
|
|
94
237
|
*/
|
|
95
|
-
|
|
238
|
+
getMaxTiles(): number;
|
|
96
239
|
/**
|
|
97
|
-
*
|
|
98
|
-
* [Limit:
|
|
99
|
-
* @
|
|
240
|
+
* Gets the tile at the specified index.
|
|
241
|
+
* @param i the tile index. [Limit: 0 >= index < #getMaxTiles()]
|
|
242
|
+
* @returns
|
|
100
243
|
*/
|
|
101
|
-
|
|
102
|
-
};
|
|
103
|
-
export declare class NavMesh {
|
|
104
|
-
raw: R.NavMesh;
|
|
105
|
-
obstacles: Map<ObstacleRef, Obstacle>;
|
|
106
|
-
constructor();
|
|
244
|
+
getTile(i: number): dtMeshTile;
|
|
107
245
|
/**
|
|
108
|
-
*
|
|
109
|
-
*
|
|
246
|
+
* Gets the tile and polygon for the specified polygon reference.
|
|
247
|
+
* @param ref The reference for the a polygon.
|
|
248
|
+
* @returns
|
|
110
249
|
*/
|
|
111
|
-
|
|
250
|
+
getTileAndPolyByRef(ref: number): NavMeshGetTileAndPolyByRefResult;
|
|
112
251
|
/**
|
|
113
|
-
*
|
|
252
|
+
* Gets the tile and polygon for the specified polygon reference.
|
|
253
|
+
* @param ref A known valid reference for a polygon.
|
|
254
|
+
* @returns
|
|
114
255
|
*/
|
|
115
|
-
|
|
256
|
+
getTileAndPolyByRefUnsafe(ref: number): NavMeshGetTileAndPolyByRefResult;
|
|
116
257
|
/**
|
|
117
|
-
*
|
|
118
|
-
* @param
|
|
119
|
-
* @
|
|
120
|
-
* @param navMeshConfig optional configuration for the NavMesh
|
|
258
|
+
* Checks the validity of a polygon reference.
|
|
259
|
+
* @param ref
|
|
260
|
+
* @returns
|
|
121
261
|
*/
|
|
122
|
-
|
|
262
|
+
isValidPolyRef(ref: number): boolean;
|
|
123
263
|
/**
|
|
124
|
-
*
|
|
125
|
-
* @param
|
|
264
|
+
* Gets the polygon reference for the tile's base polygon.
|
|
265
|
+
* @param tile
|
|
266
|
+
* @returns
|
|
126
267
|
*/
|
|
127
|
-
|
|
268
|
+
getPolyRefBase(tile: dtMeshTile): number;
|
|
128
269
|
/**
|
|
129
|
-
*
|
|
130
|
-
* @
|
|
270
|
+
* Gets the endpoints for an off-mesh connection, ordered by "direction of travel".
|
|
271
|
+
* @param prevRef The reference of the polygon before the connection.
|
|
272
|
+
* @param polyRef The reference of the off-mesh connection polygon.
|
|
273
|
+
* @returns
|
|
131
274
|
*/
|
|
132
|
-
|
|
275
|
+
getOffMeshConnectionPolyEndPoints(prevRef: number, polyRef: number): NavMeshGetOffMeshConnectionPolyEndPointsResult;
|
|
133
276
|
/**
|
|
134
|
-
*
|
|
277
|
+
* Gets the specified off-mesh connection.
|
|
278
|
+
* @param ref The polygon reference of the off-mesh connection.
|
|
279
|
+
* @returns
|
|
135
280
|
*/
|
|
136
|
-
|
|
281
|
+
getOffMeshConnectionByRef(ref: number): dtOffMeshConnection;
|
|
137
282
|
/**
|
|
138
|
-
*
|
|
283
|
+
* Sets the user defined flags for the specified polygon.
|
|
284
|
+
* @param ref The polygon reference.
|
|
285
|
+
* @param flags The new flags for the polygon.
|
|
139
286
|
*/
|
|
140
|
-
|
|
287
|
+
setPolyFlags(ref: number, flags: number): number;
|
|
141
288
|
/**
|
|
142
|
-
*
|
|
289
|
+
* Gets the user defined flags for the specified polygon.
|
|
290
|
+
* @param ref The polygon reference.
|
|
291
|
+
* @returns
|
|
143
292
|
*/
|
|
144
|
-
|
|
293
|
+
getPolyFlags(ref: number): NavMeshGetPolyFlagsResult;
|
|
145
294
|
/**
|
|
146
|
-
*
|
|
295
|
+
* Sets the user defined area for the specified polygon.
|
|
296
|
+
* @param ref The polygon reference.
|
|
297
|
+
* @param flags The new flags for the polygon.
|
|
147
298
|
*/
|
|
148
|
-
|
|
299
|
+
setPolyArea(ref: number, area: number): number;
|
|
149
300
|
/**
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
* @returns
|
|
301
|
+
* Gets the user defined area for the specified polygon.
|
|
302
|
+
* @param ref The polygon reference.
|
|
303
|
+
* @returns
|
|
153
304
|
*/
|
|
154
|
-
|
|
305
|
+
getPolyArea(ref: number): NavMeshGetPolyAreaResult;
|
|
155
306
|
/**
|
|
156
|
-
* Gets the
|
|
307
|
+
* Gets the size of the buffer required by #storeTileState to store the specified tile's state.
|
|
308
|
+
* @param tile
|
|
309
|
+
* @returns The size of the buffer required to store the state.
|
|
157
310
|
*/
|
|
158
|
-
|
|
311
|
+
getTileStateSize(tile: dtMeshTile): number;
|
|
159
312
|
/**
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
* The
|
|
313
|
+
* Stores the non-structural state of the tile in the specified buffer. (Flags, area ids, etc.)
|
|
314
|
+
* @param tile The tile.
|
|
315
|
+
* @param maxDataSize The size of the data buffer. [Limit: >= #getTileStateSize]
|
|
316
|
+
* @returns
|
|
163
317
|
*/
|
|
164
|
-
|
|
318
|
+
storeTileState(tile: dtMeshTile, maxDataSize: number): NavMeshStoreTileStateResult;
|
|
165
319
|
/**
|
|
166
|
-
*
|
|
320
|
+
* Restores the state of the tile.
|
|
321
|
+
* @param tile The tile.
|
|
322
|
+
* @param data The new state. (Obtained from @see storeTileState)
|
|
323
|
+
* @param maxDataSize The size of the state within the data buffer.
|
|
324
|
+
* @returns
|
|
167
325
|
*/
|
|
168
|
-
|
|
326
|
+
restoreTileState(tile: dtMeshTile, data: number[], maxDataSize: number): number;
|
|
169
327
|
/**
|
|
170
|
-
*
|
|
328
|
+
* Returns a DebugNavMesh that can be used to visualize the NavMesh.
|
|
171
329
|
*/
|
|
172
|
-
|
|
330
|
+
getDebugNavMesh(): DebugNavMesh;
|
|
173
331
|
/**
|
|
174
|
-
*
|
|
332
|
+
* Destroys the NavMesh.
|
|
175
333
|
*/
|
|
176
|
-
|
|
177
|
-
createCrowd(config: {
|
|
178
|
-
maxAgents: number;
|
|
179
|
-
maxAgentRadius: number;
|
|
180
|
-
}): Crowd;
|
|
334
|
+
destroy(): void;
|
|
181
335
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type R from '@recast-navigation/wasm';
|
|
2
|
+
import { NavMesh } from './nav-mesh';
|
|
3
|
+
import { BoxObstacle, CylinderObstacle, Obstacle, ObstacleRef } from './obstacle';
|
|
4
|
+
import { Vector3 } from './utils';
|
|
5
|
+
export declare type TileCacheParams = {
|
|
6
|
+
orig: ReadonlyArray<number>;
|
|
7
|
+
cs: number;
|
|
8
|
+
ch: number;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
walkableHeight: number;
|
|
12
|
+
walkableRadius: number;
|
|
13
|
+
walkableClimb: number;
|
|
14
|
+
maxSimplificationError: number;
|
|
15
|
+
maxTiles: number;
|
|
16
|
+
maxObstacles: number;
|
|
17
|
+
};
|
|
18
|
+
export declare type TileCacheUpdateResult = {
|
|
19
|
+
status: number;
|
|
20
|
+
upToDate: boolean;
|
|
21
|
+
};
|
|
22
|
+
export declare class TileCache {
|
|
23
|
+
raw: R.TileCache;
|
|
24
|
+
obstacles: Map<ObstacleRef, Obstacle>;
|
|
25
|
+
constructor(raw?: R.TileCache);
|
|
26
|
+
/**
|
|
27
|
+
* Initialises the TileCache
|
|
28
|
+
* @param params
|
|
29
|
+
*/
|
|
30
|
+
init(params: TileCacheParams): void;
|
|
31
|
+
/**
|
|
32
|
+
* Updates the tile cache by rebuilding tiles touched by unfinished obstacle requests.
|
|
33
|
+
* This should be called after adding or removing obstacles.
|
|
34
|
+
*/
|
|
35
|
+
update(navMesh: NavMesh): TileCacheUpdateResult;
|
|
36
|
+
/**
|
|
37
|
+
* Creates a cylinder obstacle and adds it to the navigation mesh.
|
|
38
|
+
*/
|
|
39
|
+
addCylinderObstacle(position: Vector3, radius: number, height: number): CylinderObstacle;
|
|
40
|
+
/**
|
|
41
|
+
* Creates a box obstacle and adds it to the navigation mesh.
|
|
42
|
+
*/
|
|
43
|
+
addBoxObstacle(position: Vector3, extent: Vector3, angle: number): BoxObstacle;
|
|
44
|
+
/**
|
|
45
|
+
* Removes an obstacle from the navigation mesh.
|
|
46
|
+
*/
|
|
47
|
+
removeObstacle(obstacle: Obstacle | ObstacleRef): void;
|
|
48
|
+
}
|
package/dist/utils.d.ts
CHANGED
|
@@ -11,12 +11,15 @@ export declare const vec3: {
|
|
|
11
11
|
y: number;
|
|
12
12
|
z: number;
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
export declare type NavPath = Vector3[];
|
|
16
|
-
export declare const navPath: {
|
|
17
|
-
fromRaw: (v: R.NavPath) => {
|
|
14
|
+
fromArray: ([x, y, z]: number[]) => {
|
|
18
15
|
x: number;
|
|
19
16
|
y: number;
|
|
20
17
|
z: number;
|
|
21
|
-
}
|
|
18
|
+
};
|
|
19
|
+
toArray: ({ x, y, z }: Vector3) => number[];
|
|
20
|
+
};
|
|
21
|
+
export declare const array: <T>(getter: (index: number) => T, count: number) => T[];
|
|
22
|
+
export declare const emscripten: {
|
|
23
|
+
isNull: (obj: unknown) => boolean;
|
|
24
|
+
getPointer: (obj: unknown) => number;
|
|
22
25
|
};
|
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.0
|
|
9
|
+
"version": "0.1.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"homepage": "https://github.com/isaac-mason/recast-navigation-js",
|
|
12
12
|
"bugs": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@babel/core": "^7.18.6",
|
|
29
|
-
"@recast-navigation/wasm": "0.0
|
|
29
|
+
"@recast-navigation/wasm": "0.1.0",
|
|
30
30
|
"@rollup/plugin-commonjs": "^24.0.1",
|
|
31
31
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
32
32
|
"@rollup/plugin-terser": "^0.4.0",
|