@soonspacejs/plugin-pathfinding 2.7.0 → 2.7.1

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.
@@ -0,0 +1,18 @@
1
+ import { NavMesh } from '@recast-navigation/core';
2
+ import { Material, Mesh } from 'three';
3
+ export type NavMeshHelperParams = {
4
+ navMesh: NavMesh;
5
+ navMeshMaterial?: Material;
6
+ };
7
+ export declare class NavMeshHelper {
8
+ navMesh: Mesh;
9
+ navMeshMaterial: Material;
10
+ recastNavMesh: NavMesh;
11
+ constructor({ navMesh, navMeshMaterial, }: NavMeshHelperParams);
12
+ /**
13
+ * Update the three debug nav mesh.
14
+ *
15
+ * This should be called after updating the nav mesh.
16
+ */
17
+ updateNavMesh(): void;
18
+ }
package/dist/index.d.ts CHANGED
@@ -1,98 +1,28 @@
1
- import { Mesh, Object3D, Vector3 } from 'three';
1
+ import { Mesh, Object3D } from 'three';
2
+ import { NavMesh, NavMeshConfig, NavMeshQuery } from '@recast-navigation/core';
2
3
  import SoonSpace from 'soonspacejs';
3
4
  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
5
  declare class PathfindingPlugin {
76
6
  readonly ssp: SoonSpace;
77
- navMesh: Record<any, any> | null;
78
- private _tempVec1;
79
- private _tempVec2;
7
+ navMesh: NavMesh | null;
8
+ navMeshQuery: NavMeshQuery | null;
9
+ debugNavMesh: Mesh | null;
80
10
  constructor(ssp: SoonSpace);
81
- createNavMesh(objects?: Object3D[], options?: INavMeshOptions): void;
11
+ createNavMesh(objects?: Object3D[], options?: Partial<NavMeshConfig>): void;
82
12
  createDebugNavMesh(): Mesh | null;
83
13
  /**
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
14
+ * Returns the closest point on the NavMesh to the given position.
15
+ * @param position
16
+ * @returns
87
17
  */
88
- getClosestPoint(position: IVector3): Vector3 | null;
18
+ getClosestPoint(position: IVector3): IVector3 | null;
89
19
  /**
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
20
+ * Finds a path from the start position to the end position.
21
+ * @param start
22
+ * @param end
23
+ * @returns
94
24
  */
95
- computePath(start: IVector3, end: IVector3): Vector3[] | null;
25
+ computePath(start: IVector3, end: IVector3): IVector3[] | null;
96
26
  dispose(): void;
97
27
  }
98
28
  export default PathfindingPlugin;