@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
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type R from '@recast-navigation/wasm';
|
|
2
|
+
export declare type CreateNavMeshDataParams = {
|
|
3
|
+
verts: number[];
|
|
4
|
+
vertCount: number;
|
|
5
|
+
polys: number[];
|
|
6
|
+
polyFlags: number[];
|
|
7
|
+
polyAreas: number[];
|
|
8
|
+
polyCount: number;
|
|
9
|
+
nvp: number;
|
|
10
|
+
detailMeshes: number[];
|
|
11
|
+
detailVerts: number[];
|
|
12
|
+
detailVertsCount: number;
|
|
13
|
+
detailTris: number[];
|
|
14
|
+
detailTriCount: number;
|
|
15
|
+
offMeshConVerts: number[];
|
|
16
|
+
offMeshConRad: number[];
|
|
17
|
+
offMeshConFlags: number[];
|
|
18
|
+
offMeshConAreas: number[];
|
|
19
|
+
offMeshConDir: number[];
|
|
20
|
+
offMeshConUserID: number[];
|
|
21
|
+
offMeshConCount: number;
|
|
22
|
+
userId: number;
|
|
23
|
+
tileX: number;
|
|
24
|
+
tileY: number;
|
|
25
|
+
tileLayer: number;
|
|
26
|
+
bmin: number[];
|
|
27
|
+
bmax: number[];
|
|
28
|
+
walkableHeight: number;
|
|
29
|
+
walkableRadius: number;
|
|
30
|
+
walkableClimb: number;
|
|
31
|
+
cs: number;
|
|
32
|
+
ch: number;
|
|
33
|
+
buildBvTree: boolean;
|
|
34
|
+
};
|
|
35
|
+
export declare type CreateNavMeshDataResult = R.CreateNavMeshDataResult;
|
|
36
|
+
export declare class NavMeshBuilder {
|
|
37
|
+
raw: R.NavMeshBuilder;
|
|
38
|
+
constructor();
|
|
39
|
+
createNavMeshData(params: CreateNavMeshDataParams): CreateNavMeshDataResult;
|
|
40
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type R from '@recast-navigation/wasm';
|
|
2
|
+
import { NavMesh } from './nav-mesh';
|
|
3
|
+
import { TileCache } from './tile-cache';
|
|
4
|
+
export declare class NavMeshExporter {
|
|
5
|
+
raw: R.NavMeshExporter;
|
|
6
|
+
constructor();
|
|
7
|
+
/**
|
|
8
|
+
* Returns a NavMesh export that can be used later. The NavMesh must be built before retrieving the data
|
|
9
|
+
* @returns data the Uint8Array that can be saved and reused
|
|
10
|
+
*/
|
|
11
|
+
export(navMesh: NavMesh, tileCache?: TileCache): Uint8Array;
|
|
12
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type R from '@recast-navigation/wasm';
|
|
2
|
+
import { NavMesh } from './nav-mesh';
|
|
3
|
+
import { TileCache } from './tile-cache';
|
|
4
|
+
export declare type NavMeshConfig = {
|
|
5
|
+
/**
|
|
6
|
+
* The size of the non-navigable border around the heightfield.
|
|
7
|
+
* [Limit: >=0] [Units: vx]
|
|
8
|
+
* @default 0
|
|
9
|
+
*/
|
|
10
|
+
borderSize: number;
|
|
11
|
+
/**
|
|
12
|
+
* The width/height size of tile's on the xz-plane.
|
|
13
|
+
* [Limit: >= 0] [Units: vx]
|
|
14
|
+
*
|
|
15
|
+
* If tileSize is provided, a tiled navmesh will be created.
|
|
16
|
+
* If tileSize is not provided, or is set to zero, a solo navmesh will be created.
|
|
17
|
+
*
|
|
18
|
+
* To use obstacles, a tiled navmesh must be generated.
|
|
19
|
+
* @default 0
|
|
20
|
+
*/
|
|
21
|
+
tileSize: number;
|
|
22
|
+
/**
|
|
23
|
+
* The xz-plane cell size to use for fields.
|
|
24
|
+
* [Limit: > 0] [Units: wu]
|
|
25
|
+
* @default 0.2
|
|
26
|
+
*/
|
|
27
|
+
cs: number;
|
|
28
|
+
/**
|
|
29
|
+
* The y-axis cell size to use for fields.
|
|
30
|
+
* Limit: > 0] [Units: wu]
|
|
31
|
+
* @default 0.2
|
|
32
|
+
*/
|
|
33
|
+
ch: number;
|
|
34
|
+
/**
|
|
35
|
+
* The maximum slope that is considered walkable.
|
|
36
|
+
* [Limits: 0 <= value < 90] [Units: Degrees]
|
|
37
|
+
* @default 60
|
|
38
|
+
*/
|
|
39
|
+
walkableSlopeAngle: number;
|
|
40
|
+
/**
|
|
41
|
+
* Minimum floor to 'ceiling' height that will still allow the floor area to be considered walkable.
|
|
42
|
+
* [Limit: >= 3] [Units: vx]
|
|
43
|
+
* @default 2
|
|
44
|
+
*/
|
|
45
|
+
walkableHeight: number;
|
|
46
|
+
/**
|
|
47
|
+
* Maximum ledge height that is considered to still be traversable.
|
|
48
|
+
* [Limit: >=0] [Units: vx]
|
|
49
|
+
* @default 2
|
|
50
|
+
*/
|
|
51
|
+
walkableClimb: number;
|
|
52
|
+
/**
|
|
53
|
+
* The distance to erode/shrink the walkable area of the heightfield away from obstructions.
|
|
54
|
+
* [Limit: >=0] [Units: vx]
|
|
55
|
+
* @default 0.5
|
|
56
|
+
*/
|
|
57
|
+
walkableRadius: number;
|
|
58
|
+
/**
|
|
59
|
+
* The maximum allowed length for contour edges along the border of the mesh.
|
|
60
|
+
* [Limit: >=0] [Units: vx]
|
|
61
|
+
* @default 12
|
|
62
|
+
*/
|
|
63
|
+
maxEdgeLen: number;
|
|
64
|
+
/**
|
|
65
|
+
* The maximum distance a simplfied contour's border edges should deviate the original raw contour.
|
|
66
|
+
* [Limit: >=0] [Units: vx]
|
|
67
|
+
* @default 1.3
|
|
68
|
+
*/
|
|
69
|
+
maxSimplificationError: number;
|
|
70
|
+
/**
|
|
71
|
+
* The minimum number of cells allowed to form isolated island areas.
|
|
72
|
+
* [Limit: >=0] [Units: vx]
|
|
73
|
+
* @default 8
|
|
74
|
+
*/
|
|
75
|
+
minRegionArea: number;
|
|
76
|
+
/**
|
|
77
|
+
* Any regions with a span count smaller than this value will, if possible, be merged with larger regions.
|
|
78
|
+
* [Limit: >=0] [Units: vx]
|
|
79
|
+
* @default 20
|
|
80
|
+
*/
|
|
81
|
+
mergeRegionArea: number;
|
|
82
|
+
/**
|
|
83
|
+
* The maximum number of vertices allowed for polygons generated during the be merged with larger regions.
|
|
84
|
+
* [Limit: >=0] [Units: vx]
|
|
85
|
+
* @default 6
|
|
86
|
+
*/
|
|
87
|
+
maxVertsPerPoly: number;
|
|
88
|
+
/**
|
|
89
|
+
* Sets the sampling distance to use when generating the detail mesh. (For height detail only.)
|
|
90
|
+
* [Limits: 0 or >= 0.9] [Units: wu]
|
|
91
|
+
* @default 6
|
|
92
|
+
*/
|
|
93
|
+
detailSampleDist: number;
|
|
94
|
+
/**
|
|
95
|
+
* The maximum distance the detail mesh surface should deviate from heightfield data. (For height detail only.)
|
|
96
|
+
* [Limit: >=0] [Units: wu]
|
|
97
|
+
* @default 1
|
|
98
|
+
*/
|
|
99
|
+
detailSampleMaxError: number;
|
|
100
|
+
};
|
|
101
|
+
export declare type NavMeshGeneratorResult = {
|
|
102
|
+
success: boolean;
|
|
103
|
+
navMesh: NavMesh;
|
|
104
|
+
tileCache: TileCache;
|
|
105
|
+
};
|
|
106
|
+
export declare class NavMeshGenerator {
|
|
107
|
+
raw: R.NavMeshGenerator;
|
|
108
|
+
constructor();
|
|
109
|
+
/**
|
|
110
|
+
* Builds a NavMesh from the given positions and indices.
|
|
111
|
+
* @param positions a flat array of positions
|
|
112
|
+
* @param indices a flat array of indices
|
|
113
|
+
* @param navMeshConfig optional configuration for the NavMesh
|
|
114
|
+
*/
|
|
115
|
+
generate(positions: ArrayLike<number>, indices: ArrayLike<number>, navMeshConfig?: Partial<NavMeshConfig>): NavMeshGeneratorResult;
|
|
116
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type R from '@recast-navigation/wasm';
|
|
2
|
+
import { NavMesh } from './nav-mesh';
|
|
3
|
+
import { TileCache } from './tile-cache';
|
|
4
|
+
export declare type NavMeshImporterResult = {
|
|
5
|
+
navMesh: NavMesh;
|
|
6
|
+
tileCache: TileCache;
|
|
7
|
+
};
|
|
8
|
+
export declare class NavMeshImporter {
|
|
9
|
+
raw: R.NavMeshImporter;
|
|
10
|
+
constructor();
|
|
11
|
+
/**
|
|
12
|
+
* Build the navmesh from a previously saved state using getNavMeshExport
|
|
13
|
+
* @param data the Uint8Array returned by `getNavMeshExport`
|
|
14
|
+
*/
|
|
15
|
+
import(data: Uint8Array): NavMeshImporterResult;
|
|
16
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type R from '@recast-navigation/wasm';
|
|
2
|
+
import { NavMesh } from './nav-mesh';
|
|
3
|
+
import { Vector3 } from './utils';
|
|
4
|
+
export declare type NavMeshQueryParams = {
|
|
5
|
+
navMesh: NavMesh;
|
|
6
|
+
/**
|
|
7
|
+
* @default 2048
|
|
8
|
+
*/
|
|
9
|
+
maxNodes?: number;
|
|
10
|
+
};
|
|
11
|
+
export declare class NavMeshQuery {
|
|
12
|
+
raw: R.NavMeshQuery;
|
|
13
|
+
constructor({ navMesh, maxNodes }: NavMeshQueryParams);
|
|
14
|
+
/**
|
|
15
|
+
* Returns the closest point on the NavMesh to the given position.
|
|
16
|
+
*/
|
|
17
|
+
getClosestPoint(position: Vector3): Vector3;
|
|
18
|
+
/**
|
|
19
|
+
* Returns a random point on the NavMesh within the given radius of the given position.
|
|
20
|
+
*/
|
|
21
|
+
getRandomPointAround(position: Vector3, radius: number): Vector3;
|
|
22
|
+
/**
|
|
23
|
+
* Compute the final position from a segment made of destination-position
|
|
24
|
+
*/
|
|
25
|
+
moveAlong(position: Vector3, destination: Vector3): Vector3;
|
|
26
|
+
/**
|
|
27
|
+
* Finds a path from the start position to the end position.
|
|
28
|
+
*g
|
|
29
|
+
* @returns an array of Vector3 positions that make up the path, or an empty array if no path was found.
|
|
30
|
+
*/
|
|
31
|
+
computePath(start: Vector3, end: Vector3): Vector3[];
|
|
32
|
+
/**
|
|
33
|
+
* Gets the Bounding box extent specified by setDefaultQueryExtent
|
|
34
|
+
*/
|
|
35
|
+
getDefaultQueryExtent(): Vector3;
|
|
36
|
+
/**
|
|
37
|
+
* Sets the Bounding box extent for doing spatial queries (getClosestPoint, getRandomPointAround, ...)
|
|
38
|
+
* The queries will try to find a solution within those bounds.
|
|
39
|
+
* The default is (1,1,1)
|
|
40
|
+
*/
|
|
41
|
+
setDefaultQueryExtent(extent: Vector3): void;
|
|
42
|
+
/**
|
|
43
|
+
* Destroys the NavMeshQuery instance
|
|
44
|
+
*/
|
|
45
|
+
destroy(): void;
|
|
46
|
+
}
|