@soonspacejs/plugin-pathfinding 2.6.2
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/README.md +5 -0
- package/dist/index.d.ts +98 -0
- package/dist/index.esm.js +1 -0
- package/package.json +20 -0
package/README.md
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Mesh, Object3D, Vector3 } from 'three';
|
|
2
|
+
import SoonSpace from 'soonspacejs';
|
|
3
|
+
import { IVector3 } from 'soonspacejs/types/Interface';
|
|
4
|
+
export interface INavMeshOptions {
|
|
5
|
+
/**
|
|
6
|
+
* The xz-plane cell size to use for fields. [Limit: > 0] [Units: wu]
|
|
7
|
+
*/
|
|
8
|
+
cs?: number;
|
|
9
|
+
/**
|
|
10
|
+
* The y-axis cell size to use for fields. [Limit: > 0] [Units: wu]
|
|
11
|
+
*/
|
|
12
|
+
ch?: number;
|
|
13
|
+
/**
|
|
14
|
+
* The maximum slope that is considered walkable. [Limits: 0 <= value < 90] [Units: Degrees]
|
|
15
|
+
*/
|
|
16
|
+
walkableSlopeAngle?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Minimum floor to 'ceiling' height that will still allow the floor area to
|
|
19
|
+
* be considered walkable. [Limit: >= 3] [Units: vx]
|
|
20
|
+
*/
|
|
21
|
+
walkableHeight?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Maximum ledge height that is considered to still be traversable. [Limit: >=0] [Units: vx]
|
|
24
|
+
*/
|
|
25
|
+
walkableClimb?: number;
|
|
26
|
+
/**
|
|
27
|
+
* The distance to erode/shrink the walkable area of the heightfield away from
|
|
28
|
+
* obstructions. [Limit: >=0] [Units: vx]
|
|
29
|
+
*/
|
|
30
|
+
walkableRadius?: number;
|
|
31
|
+
/**
|
|
32
|
+
* The maximum allowed length for contour edges along the border of the mesh. [Limit: >=0] [Units: vx]
|
|
33
|
+
*/
|
|
34
|
+
maxEdgeLen?: number;
|
|
35
|
+
/**
|
|
36
|
+
* The maximum distance a simplified contour's border edges should deviate
|
|
37
|
+
* the original raw contour. [Limit: >=0] [Units: vx]
|
|
38
|
+
*/
|
|
39
|
+
maxSimplificationError?: number;
|
|
40
|
+
/**
|
|
41
|
+
* The minimum number of cells allowed to form isolated island areas. [Limit: >=0] [Units: vx]
|
|
42
|
+
*/
|
|
43
|
+
minRegionArea?: number;
|
|
44
|
+
/**
|
|
45
|
+
* Any regions with a span count smaller than this value will, if possible,
|
|
46
|
+
* be merged with larger regions. [Limit: >=0] [Units: vx]
|
|
47
|
+
*/
|
|
48
|
+
mergeRegionArea?: number;
|
|
49
|
+
/**
|
|
50
|
+
* The maximum number of vertices allowed for polygons generated during the
|
|
51
|
+
* contour to polygon conversion process. [Limit: >= 3]
|
|
52
|
+
*/
|
|
53
|
+
maxVertsPerPoly?: number;
|
|
54
|
+
/**
|
|
55
|
+
* Sets the sampling distance to use when generating the detail mesh.
|
|
56
|
+
* (For height detail only.) [Limits: 0 or >= 0.9] [Units: wu]
|
|
57
|
+
*/
|
|
58
|
+
detailSampleDist?: number;
|
|
59
|
+
/**
|
|
60
|
+
* The maximum distance the detail mesh surface should deviate from heightfield
|
|
61
|
+
* data. (For height detail only.) [Limit: >=0] [Units: wu]
|
|
62
|
+
*/
|
|
63
|
+
detailSampleMaxError?: number;
|
|
64
|
+
/**
|
|
65
|
+
* If using obstacles, the navmesh must be subdivided internaly by tiles.
|
|
66
|
+
* This member defines the tile cube side length in world units.
|
|
67
|
+
* If no obstacles are needed, leave it undefined or 0.
|
|
68
|
+
*/
|
|
69
|
+
tileSize?: number;
|
|
70
|
+
/**
|
|
71
|
+
* The size of the non-navigable border around the heightfield.
|
|
72
|
+
*/
|
|
73
|
+
borderSize?: number;
|
|
74
|
+
}
|
|
75
|
+
declare class PathfindingPlugin {
|
|
76
|
+
readonly ssp: SoonSpace;
|
|
77
|
+
navMesh: Record<any, any> | null;
|
|
78
|
+
private _tempVec1;
|
|
79
|
+
private _tempVec2;
|
|
80
|
+
constructor(ssp: SoonSpace);
|
|
81
|
+
createNavMesh(objects?: Object3D[], options?: INavMeshOptions): void;
|
|
82
|
+
createDebugNavMesh(): Mesh | null;
|
|
83
|
+
/**
|
|
84
|
+
* Get a navigation mesh constrained position, closest to the parameter position
|
|
85
|
+
* @param position world position
|
|
86
|
+
* @returns the closest point to position constrained by the navigation mesh
|
|
87
|
+
*/
|
|
88
|
+
getClosestPoint(position: IVector3): Vector3 | null;
|
|
89
|
+
/**
|
|
90
|
+
* Compute a navigation path from start to end. Returns an empty array if no path can be computed
|
|
91
|
+
* @param start world position
|
|
92
|
+
* @param end world position
|
|
93
|
+
* @returns array containing world position composing the path
|
|
94
|
+
*/
|
|
95
|
+
computePath(start: IVector3, end: IVector3): Vector3[] | null;
|
|
96
|
+
dispose(): void;
|
|
97
|
+
}
|
|
98
|
+
export default PathfindingPlugin;
|