@recast-navigation/core 0.27.0 → 0.29.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/arrays.d.ts +47 -12
- package/dist/crowd.d.ts +63 -24
- package/dist/detour.d.ts +24 -17
- package/dist/index.d.ts +0 -2
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/nav-mesh-query.d.ts +61 -8
- package/dist/nav-mesh.d.ts +21 -13
- package/dist/raw.d.ts +35 -34
- package/dist/recast.d.ts +40 -33
- package/dist/serdes/import-nav-mesh.d.ts +3 -3
- package/dist/tile-cache.d.ts +19 -11
- package/dist/utils.d.ts +5 -3
- package/package.json +8 -4
- package/dist/index.cjs +0 -2
- package/dist/index.cjs.map +0 -1
- package/dist/raw-module.d.ts +0 -2
package/dist/arrays.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import RawModule from './raw
|
|
1
|
+
import { RawModule } from './raw';
|
|
2
2
|
type TypedArray = typeof Int32Array | typeof Uint32Array | typeof Uint8Array | typeof Uint16Array | typeof Float32Array;
|
|
3
3
|
declare abstract class BaseArray<RawType extends RawModule.IntArray | RawModule.UnsignedIntArray | RawModule.UnsignedCharArray | RawModule.UnsignedShortArray | RawModule.FloatArray, T extends TypedArray> {
|
|
4
4
|
raw: RawType;
|
|
@@ -9,40 +9,75 @@ declare abstract class BaseArray<RawType extends RawModule.IntArray | RawModule.
|
|
|
9
9
|
set(i: number, value: number): void;
|
|
10
10
|
resize(size: number): void;
|
|
11
11
|
copy(data: InstanceType<T> | number[]): void;
|
|
12
|
-
|
|
12
|
+
destroy(): void;
|
|
13
13
|
getHeapView(): InstanceType<T>;
|
|
14
14
|
toTypedArray(): InstanceType<T>;
|
|
15
15
|
protected abstract getHeap(): InstanceType<T>;
|
|
16
16
|
}
|
|
17
17
|
export declare class IntArray extends BaseArray<RawModule.IntArray, typeof Int32Array> {
|
|
18
18
|
typedArrayClass: Int32ArrayConstructor;
|
|
19
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Creates a new IntArray.
|
|
21
|
+
*/
|
|
22
|
+
constructor();
|
|
23
|
+
/**
|
|
24
|
+
* Creates a wrapper around an existing raw IntArray object.
|
|
25
|
+
*/
|
|
26
|
+
constructor(raw: RawModule.IntArray);
|
|
20
27
|
protected getHeap(): Int32Array;
|
|
21
|
-
static fromRaw(raw
|
|
28
|
+
static fromRaw(raw: RawModule.IntArray): IntArray;
|
|
22
29
|
}
|
|
23
30
|
export declare class UnsignedIntArray extends BaseArray<RawModule.UnsignedIntArray, typeof Uint32Array> {
|
|
24
31
|
typedArrayClass: Uint32ArrayConstructor;
|
|
25
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Creates a new UnsignedIntArray.
|
|
34
|
+
*/
|
|
35
|
+
constructor();
|
|
36
|
+
/**
|
|
37
|
+
* Creates a wrapper around an existing raw UnsignedIntArray object.
|
|
38
|
+
*/
|
|
39
|
+
constructor(raw: RawModule.UnsignedIntArray);
|
|
26
40
|
protected getHeap(): Uint32Array;
|
|
27
|
-
static fromRaw(raw
|
|
41
|
+
static fromRaw(raw: RawModule.UnsignedIntArray): UnsignedIntArray;
|
|
28
42
|
}
|
|
29
43
|
export declare class UnsignedCharArray extends BaseArray<RawModule.UnsignedCharArray, typeof Uint8Array> {
|
|
30
44
|
typedArrayClass: Uint8ArrayConstructor;
|
|
31
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Creates a new UnsignedCharArray.
|
|
47
|
+
*/
|
|
48
|
+
constructor();
|
|
49
|
+
/**
|
|
50
|
+
* Creates a wrapper around an existing raw UnsignedCharArray object.
|
|
51
|
+
*/
|
|
52
|
+
constructor(raw: RawModule.UnsignedCharArray);
|
|
32
53
|
protected getHeap(): Uint8Array;
|
|
33
|
-
static fromRaw(raw
|
|
54
|
+
static fromRaw(raw: RawModule.UnsignedCharArray): UnsignedCharArray;
|
|
34
55
|
}
|
|
35
56
|
export declare class UnsignedShortArray extends BaseArray<RawModule.UnsignedShortArray, typeof Uint16Array> {
|
|
36
57
|
typedArrayClass: Uint16ArrayConstructor;
|
|
37
|
-
|
|
58
|
+
/**
|
|
59
|
+
* Creates a new UnsignedShortArray.
|
|
60
|
+
*/
|
|
61
|
+
constructor();
|
|
62
|
+
/**
|
|
63
|
+
* Creates a wrapper around an existing raw UnsignedShortArray object.
|
|
64
|
+
*/
|
|
65
|
+
constructor(raw: RawModule.UnsignedShortArray);
|
|
38
66
|
protected getHeap(): Uint16Array;
|
|
39
|
-
static fromRaw(raw
|
|
67
|
+
static fromRaw(raw: RawModule.UnsignedShortArray): UnsignedShortArray;
|
|
40
68
|
}
|
|
41
69
|
export declare class FloatArray extends BaseArray<RawModule.FloatArray, typeof Float32Array> {
|
|
42
70
|
typedArrayClass: Float32ArrayConstructor;
|
|
43
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Creates a new FloatArray.
|
|
73
|
+
*/
|
|
74
|
+
constructor();
|
|
75
|
+
/**
|
|
76
|
+
* Creates a wrapper around an existing raw FloatArray object.
|
|
77
|
+
*/
|
|
78
|
+
constructor(raw: RawModule.FloatArray);
|
|
44
79
|
protected getHeap(): Float32Array;
|
|
45
|
-
static fromRaw(raw
|
|
80
|
+
static fromRaw(raw: RawModule.FloatArray): FloatArray;
|
|
46
81
|
}
|
|
47
82
|
export declare const VerticesArray: typeof FloatArray;
|
|
48
83
|
export declare const TrianglesArray: typeof IntArray;
|
package/dist/crowd.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { NavMesh } from './nav-mesh';
|
|
2
2
|
import { NavMeshQuery, QueryFilter } from './nav-mesh-query';
|
|
3
|
-
import
|
|
3
|
+
import { RawModule } from './raw';
|
|
4
4
|
import { Vector3 } from './utils';
|
|
5
5
|
export type CrowdAgentParams = {
|
|
6
6
|
/**
|
|
@@ -67,7 +67,7 @@ export declare const crowdAgentParamsDefaults: CrowdAgentParams;
|
|
|
67
67
|
export declare class CrowdAgent implements CrowdAgentParams {
|
|
68
68
|
crowd: Crowd;
|
|
69
69
|
agentIndex: number;
|
|
70
|
-
raw:
|
|
70
|
+
raw: RawModule.dtCrowdAgent;
|
|
71
71
|
get radius(): number;
|
|
72
72
|
set radius(value: number);
|
|
73
73
|
get height(): number;
|
|
@@ -90,6 +90,13 @@ export declare class CrowdAgent implements CrowdAgentParams {
|
|
|
90
90
|
set queryFilterType(value: number);
|
|
91
91
|
get userData(): unknown;
|
|
92
92
|
set userData(value: unknown);
|
|
93
|
+
/**
|
|
94
|
+
* The interpolated position of the agent.
|
|
95
|
+
*
|
|
96
|
+
* Use this if stepping the crowd with interpolation.
|
|
97
|
+
* This will not be updated if stepping the crowd without interpolation.
|
|
98
|
+
*/
|
|
99
|
+
interpolatedPosition: Vector3;
|
|
93
100
|
constructor(crowd: Crowd, agentIndex: number);
|
|
94
101
|
/**
|
|
95
102
|
* Updates the agent's target.
|
|
@@ -118,10 +125,17 @@ export declare class CrowdAgent implements CrowdAgentParams {
|
|
|
118
125
|
*/
|
|
119
126
|
position(): Vector3;
|
|
120
127
|
/**
|
|
121
|
-
* The velocity of the agent.
|
|
122
|
-
* @returns
|
|
128
|
+
* The actual velocity of the agent. The change from velocityDesiredObstacleAdjusted -> velocity is constrained by max acceleration.
|
|
123
129
|
*/
|
|
124
130
|
velocity(): Vector3;
|
|
131
|
+
/**
|
|
132
|
+
* The desired velocity of the agent. Based on the current path, calculated from scratch each frame.
|
|
133
|
+
*/
|
|
134
|
+
desiredVelocity(): Vector3;
|
|
135
|
+
/**
|
|
136
|
+
* The desired velocity adjusted by obstacle avoidance, calculated from scratch each frame.
|
|
137
|
+
*/
|
|
138
|
+
desiredVelocityObstacleAdjusted(): Vector3;
|
|
125
139
|
/**
|
|
126
140
|
* Returns the next target position on the path to the target
|
|
127
141
|
* @returns
|
|
@@ -169,13 +183,9 @@ export type CrowdParams = {
|
|
|
169
183
|
* [Limit: > 0]
|
|
170
184
|
*/
|
|
171
185
|
maxAgentRadius: number;
|
|
172
|
-
/**
|
|
173
|
-
* The navigation mesh to use for planning.
|
|
174
|
-
*/
|
|
175
|
-
navMesh: NavMesh;
|
|
176
186
|
};
|
|
177
187
|
export declare class Crowd {
|
|
178
|
-
raw:
|
|
188
|
+
raw: RawModule.dtCrowd;
|
|
179
189
|
/**
|
|
180
190
|
* The agents in the crowd.
|
|
181
191
|
*/
|
|
@@ -187,28 +197,57 @@ export declare class Crowd {
|
|
|
187
197
|
*/
|
|
188
198
|
navMesh: NavMesh;
|
|
189
199
|
/**
|
|
190
|
-
*
|
|
191
|
-
* If more iterations are need to reach deltatime they will be discarded.
|
|
192
|
-
* A value of 0 will set to no maximum and update will use as many substeps as needed.
|
|
193
|
-
*/
|
|
194
|
-
maximumSubStepCount: number;
|
|
195
|
-
/**
|
|
196
|
-
* Get the time step of the navigation tick update.
|
|
200
|
+
* The NavMeshQuery used to find nearest polys for commands
|
|
197
201
|
*/
|
|
198
|
-
|
|
202
|
+
navMeshQuery: NavMeshQuery;
|
|
199
203
|
/**
|
|
200
|
-
*
|
|
204
|
+
* Accumulator for fixed updates with interpolation
|
|
201
205
|
*/
|
|
202
|
-
|
|
206
|
+
private accumulator;
|
|
203
207
|
/**
|
|
204
|
-
*
|
|
208
|
+
*
|
|
209
|
+
* @param navMesh the navmesh the crowd will use for planning
|
|
210
|
+
* @param param1 the crowd parameters
|
|
211
|
+
*
|
|
212
|
+
* @example
|
|
213
|
+
* ```ts
|
|
214
|
+
* const crowd = new Crowd(navMesh, {
|
|
215
|
+
* maxAgents: 100,
|
|
216
|
+
* maxAgentRadius: 1,
|
|
217
|
+
* });
|
|
218
|
+
* ```
|
|
205
219
|
*/
|
|
206
|
-
|
|
207
|
-
constructor({ maxAgents, maxAgentRadius, navMesh }: CrowdParams);
|
|
220
|
+
constructor(navMesh: NavMesh, { maxAgents, maxAgentRadius }: CrowdParams);
|
|
208
221
|
/**
|
|
209
|
-
*
|
|
222
|
+
* Steps the crowd forward in time with a fixed time step.
|
|
223
|
+
*
|
|
224
|
+
* There are two modes. The simple mode is fixed timestepping without interpolation. In this case you only use the first argument. The second case uses interpolation. In that you also provide the time since the function was last used, as well as the maximum fixed timesteps to take.
|
|
225
|
+
*
|
|
226
|
+
* @param dt The fixed time step size to use.
|
|
227
|
+
* @param timeSinceLastCalled The time elapsed since the function was last called.
|
|
228
|
+
* @param maxSubSteps Maximum number of fixed steps to take per function call.
|
|
229
|
+
*
|
|
230
|
+
* @example fixed time stepping
|
|
231
|
+
* ```ts
|
|
232
|
+
* const deltaTime = 1 / 60;
|
|
233
|
+
* crowd.update(deltaTime);
|
|
234
|
+
* ```
|
|
235
|
+
*
|
|
236
|
+
* @example variable time stepping
|
|
237
|
+
* ```ts
|
|
238
|
+
* crowd.update(timeSinceLastUpdate);
|
|
239
|
+
* ```
|
|
240
|
+
*
|
|
241
|
+
* @example fixed time stepping with interpolation
|
|
242
|
+
* ```ts
|
|
243
|
+
* const deltaTime = 1 / 60;
|
|
244
|
+
* const maxSubSteps = 10;
|
|
245
|
+
* crowd.update(deltaTime, timeSinceLastUpdate, maxSubSteps);
|
|
246
|
+
*
|
|
247
|
+
* console.log(agent.interpolatedPosition);
|
|
248
|
+
* ```
|
|
210
249
|
*/
|
|
211
|
-
update(
|
|
250
|
+
update(dt: number, timeSinceLastCalled?: number, maxSubSteps?: number): void;
|
|
212
251
|
/**
|
|
213
252
|
* Adds a new agent to the crowd.
|
|
214
253
|
*/
|
package/dist/detour.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UnsignedCharArray } from './arrays';
|
|
2
|
-
import type
|
|
2
|
+
import { type RawModule } from './raw';
|
|
3
3
|
import { RecastPolyMesh, RecastPolyMeshDetail } from './recast';
|
|
4
4
|
import { Vector3, Vector3Tuple } from './utils';
|
|
5
5
|
export declare const statusSucceed: (status: number) => boolean;
|
|
@@ -8,16 +8,16 @@ export declare const statusInProgress: (status: number) => boolean;
|
|
|
8
8
|
export declare const statusDetail: (status: number, detail: number) => boolean;
|
|
9
9
|
export declare const statusToReadableString: (status: number) => string;
|
|
10
10
|
export declare class DetourPolyDetail {
|
|
11
|
-
raw:
|
|
12
|
-
constructor(raw:
|
|
11
|
+
raw: RawModule.dtPolyDetail;
|
|
12
|
+
constructor(raw: RawModule.dtPolyDetail);
|
|
13
13
|
vertBase(): number;
|
|
14
14
|
triBase(): number;
|
|
15
15
|
vertCount(): number;
|
|
16
16
|
triCount(): number;
|
|
17
17
|
}
|
|
18
18
|
export declare class DetourLink {
|
|
19
|
-
raw:
|
|
20
|
-
constructor(raw:
|
|
19
|
+
raw: RawModule.dtLink;
|
|
20
|
+
constructor(raw: RawModule.dtLink);
|
|
21
21
|
ref(): number;
|
|
22
22
|
next(): number;
|
|
23
23
|
edge(): number;
|
|
@@ -26,15 +26,15 @@ export declare class DetourLink {
|
|
|
26
26
|
bmax(): number;
|
|
27
27
|
}
|
|
28
28
|
export declare class DetourBVNode {
|
|
29
|
-
raw:
|
|
30
|
-
constructor(raw:
|
|
29
|
+
raw: RawModule.dtBVNode;
|
|
30
|
+
constructor(raw: RawModule.dtBVNode);
|
|
31
31
|
bmin(): Vector3;
|
|
32
32
|
bmax(): Vector3;
|
|
33
33
|
i(): number;
|
|
34
34
|
}
|
|
35
35
|
export declare class DetourOffMeshConnection {
|
|
36
|
-
raw:
|
|
37
|
-
constructor(raw:
|
|
36
|
+
raw: RawModule.dtOffMeshConnection;
|
|
37
|
+
constructor(raw: RawModule.dtOffMeshConnection);
|
|
38
38
|
pos(index: number): number;
|
|
39
39
|
rad(): number;
|
|
40
40
|
poly(): number;
|
|
@@ -43,8 +43,8 @@ export declare class DetourOffMeshConnection {
|
|
|
43
43
|
userId(): number;
|
|
44
44
|
}
|
|
45
45
|
export declare class DetourMeshHeader {
|
|
46
|
-
raw:
|
|
47
|
-
constructor(raw:
|
|
46
|
+
raw: RawModule.dtMeshHeader;
|
|
47
|
+
constructor(raw: RawModule.dtMeshHeader);
|
|
48
48
|
magic(): number;
|
|
49
49
|
version(): number;
|
|
50
50
|
x(): number;
|
|
@@ -68,8 +68,8 @@ export declare class DetourMeshHeader {
|
|
|
68
68
|
bvQuantFactor(): number;
|
|
69
69
|
}
|
|
70
70
|
export declare class DetourPoly {
|
|
71
|
-
raw:
|
|
72
|
-
constructor(raw:
|
|
71
|
+
raw: RawModule.dtPoly;
|
|
72
|
+
constructor(raw: RawModule.dtPoly);
|
|
73
73
|
firstLink(): number;
|
|
74
74
|
verts(index: number): number;
|
|
75
75
|
neis(index: number): number;
|
|
@@ -79,8 +79,8 @@ export declare class DetourPoly {
|
|
|
79
79
|
getType(): number;
|
|
80
80
|
}
|
|
81
81
|
export declare class DetourMeshTile {
|
|
82
|
-
raw:
|
|
83
|
-
constructor(raw:
|
|
82
|
+
raw: RawModule.dtMeshTile;
|
|
83
|
+
constructor(raw: RawModule.dtMeshTile);
|
|
84
84
|
salt(): number;
|
|
85
85
|
linksFreeList(): number;
|
|
86
86
|
header(): DetourMeshHeader | null;
|
|
@@ -117,8 +117,15 @@ export type OffMeshConnectionParams = {
|
|
|
117
117
|
userId?: number;
|
|
118
118
|
};
|
|
119
119
|
export declare class NavMeshCreateParams {
|
|
120
|
-
raw:
|
|
121
|
-
|
|
120
|
+
raw: RawModule.dtNavMeshCreateParams;
|
|
121
|
+
/**
|
|
122
|
+
* Creates a new NavMeshCreateParams object.
|
|
123
|
+
*/
|
|
124
|
+
constructor();
|
|
125
|
+
/**
|
|
126
|
+
* Creates a wrapper around an existing raw NavMeshCreateParams object.
|
|
127
|
+
*/
|
|
128
|
+
constructor(raw: RawModule.dtNavMeshCreateParams);
|
|
122
129
|
setPolyMeshCreateParams(polyMesh: RecastPolyMesh): void;
|
|
123
130
|
setPolyMeshDetailCreateParams(polyMeshDetail: RecastPolyMeshDetail): void;
|
|
124
131
|
setOffMeshConnections(offMeshConnections: OffMeshConnectionParams[]): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import Wasm from './raw-module';
|
|
2
1
|
export * from './arrays';
|
|
3
2
|
export * from './crowd';
|
|
4
3
|
export * from './detour';
|
|
@@ -9,4 +8,3 @@ export * from './recast';
|
|
|
9
8
|
export * from './serdes';
|
|
10
9
|
export * from './tile-cache';
|
|
11
10
|
export * from './utils';
|
|
12
|
-
export { Wasm };
|