@recast-navigation/core 0.0.5 → 0.0.6

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 CHANGED
@@ -2,68 +2,96 @@ import type R from '@recast-navigation/wasm';
2
2
  import type { NavMesh } from './nav-mesh';
3
3
  import type { NavPath, Vector3 } from './utils';
4
4
  export declare type CrowdParams = {
5
+ /**
6
+ * The maximum number of agents that can be managed by the crowd.
7
+ * [Limit: >= 1]
8
+ */
5
9
  maxAgents: number;
10
+ /**
11
+ * The maximum radius of any agent that will be added to the crowd.
12
+ * [Limit: > 0]
13
+ */
6
14
  maxAgentRadius: number;
15
+ /**
16
+ * The navigation mesh to use for planning.
17
+ */
7
18
  navMesh: NavMesh;
8
19
  };
9
20
  export declare type CrowdAgentParams = {
10
21
  /**
22
+ * The radius of the agent.
11
23
  * @default 0.5
12
24
  */
13
25
  radius: number;
14
26
  /**
27
+ * The height of the agent.
15
28
  * @default 1
16
29
  */
17
30
  height: number;
18
31
  /**
32
+ * The maximum allowed acceleration for the agent.
19
33
  * @default 20
20
34
  */
21
35
  maxAcceleration: number;
22
36
  /**
37
+ * The maximum allowed speed for the agent.
23
38
  * @default 6
24
39
  */
25
40
  maxSpeed: number;
26
41
  /**
42
+ * Defines how close a collision element must be before it is considered for steering behaviors.
43
+ * [Limits: > 0]
27
44
  * @default 2.5
28
45
  */
29
46
  collisionQueryRange: number;
30
47
  /**
48
+ * The path visibility optimization range.
49
+ * [Limit: > 0]
31
50
  * @default 0
32
51
  */
33
52
  pathOptimizationRange: number;
34
53
  /**
54
+ * How aggresive the agent manager should be at avoiding collisions with this agent.
55
+ * [Limit: >= 0]
35
56
  * @default 0
36
57
  */
37
58
  separationWeight: number;
38
59
  /**
60
+ * Flags that impact steering behavior.
39
61
  * @default 7
40
62
  */
41
63
  updateFlags: number;
42
64
  /**
65
+ * The index of the avoidance configuration to use for the agent.
66
+ * [Limits: 0 <= value <= #DT_CROWD_MAX_OBSTAVOIDANCE_PARAMS]
43
67
  * @default 0
44
68
  */
45
69
  obstacleAvoidanceType: number;
46
70
  /**
71
+ * The index of the query filter used by this agent.
47
72
  * @default 0
48
73
  */
49
74
  queryFilterType: number;
50
75
  /**
76
+ * User defined data attached to the agent.
51
77
  * @default 0
52
78
  */
53
79
  userData: unknown;
54
80
  };
55
81
  export declare class Crowd {
56
82
  raw: R.Crowd;
83
+ /**
84
+ * The indices of the active agents in the crowd.
85
+ */
57
86
  agents: number[];
58
87
  /**
59
- * The NavMesh the crowd is interacting with
88
+ * The NavMesh the crowd is interacting with.
60
89
  */
61
90
  navMesh: NavMesh;
62
91
  /**
63
- * If delta time in navigation tick update is greater than the time step
64
- * a number of sub iterations are done. If more iterations are need to reach deltatime
65
- * they will be discarded.
66
- * A value of 0 will set to no maximum and update will use as many substeps as needed
92
+ * If delta time in navigation tick update is greater than the time step a number of sub iterations are done.
93
+ * If more iterations are need to reach deltatime they will be discarded.
94
+ * A value of 0 will set to no maximum and update will use as many substeps as needed.
67
95
  */
68
96
  maximumSubStepCount: number;
69
97
  /**
@@ -75,12 +103,33 @@ export declare class Crowd {
75
103
  */
76
104
  timeFactor: number;
77
105
  constructor({ maxAgents, maxAgentRadius, navMesh }: CrowdParams);
106
+ /**
107
+ * Adds a new agent to the crowd.
108
+ */
78
109
  addAgent(position: Vector3, crowdAgentParams: Partial<CrowdAgentParams>): number;
110
+ /**
111
+ * Removes the agent from the crowd.
112
+ */
79
113
  removeAgent(agentIndex: number): void;
114
+ /**
115
+ * Submits a new move request for the specified agent.
116
+ */
80
117
  goto(agentIndex: number, position: Vector3): void;
118
+ /**
119
+ * Teleports the agent to the given position.
120
+ */
81
121
  teleport(agentIndex: number, position: Vector3): void;
122
+ /**
123
+ * Resets the current move request for the specified agent.
124
+ */
82
125
  resetMoveTarget(agentIndex: number): void;
126
+ /**
127
+ * Updates the crowd
128
+ */
83
129
  update(deltaTime: number): void;
130
+ /**
131
+ * Destroys the crowd.
132
+ */
84
133
  destroy(): void;
85
134
  /**
86
135
  * Returns the maximum number of agents that can be managed by the crowd.
@@ -90,15 +139,60 @@ export declare class Crowd {
90
139
  * Returns the number of active agents in the crowd.
91
140
  */
92
141
  getActiveAgentCount(): number;
142
+ /**
143
+ * Returns the indices of all active agents.
144
+ */
93
145
  getAgents(): number[];
146
+ /**
147
+ * Returns the position of the specified agent.
148
+ */
94
149
  getAgentPosition(agentIndex: number): Vector3;
150
+ /**
151
+ * Returns the velocity of the specified agent.
152
+ */
95
153
  getAgentVelocity(agentIndex: number): Vector3;
154
+ /**
155
+ * Returns the next target position on the path to the specified agents target.
156
+ */
96
157
  getAgentNextTargetPath(agentIndex: number): Vector3;
158
+ /**
159
+ * Returns the state of the specified agent.
160
+ *
161
+ * 0 = DT_CROWDAGENT_STATE_INVALID
162
+ * 1 = DT_CROWDAGENT_STATE_WALKING
163
+ * 2 = DT_CROWDAGENT_STATE_OFFMESH
164
+ */
97
165
  getAgentState(agentIndex: number): number;
166
+ /**
167
+ * Returns the local path corridor corners for the specified agent.
168
+ */
98
169
  getAgentCorners(agentIndex: number): NavPath;
170
+ /**
171
+ * Returns the parameters for the specified agent.
172
+ */
99
173
  getAgentParameters(agentIndex: number): CrowdAgentParams;
174
+ /**
175
+ * Sets the parameters for the specified agent.
176
+ * Any parameters not specified in the crowdAgentParams object will be set to their default values.
177
+ * @param agentIndex
178
+ * @param crowdAgentParams
179
+ */
100
180
  setAgentParameters(agentIndex: number, crowdAgentParams: Partial<CrowdAgentParams>): void;
181
+ /**
182
+ * Updates the parameters for the specified agent.
183
+ * Any parameters not specified in the crowdAgentParams object will be unchanged.
184
+ * @param agentIndex
185
+ * @param crowdAgentParams
186
+ */
101
187
  updateAgentParameters(agentIndex: number, crowdAgentParams: Partial<CrowdAgentParams>): void;
188
+ /**
189
+ * Gets the bounding box extent for doing spatial queries.
190
+ */
102
191
  getDefaultQueryExtent(): Vector3;
192
+ /**
193
+ * Sets the Bounding box extent for doing spatial queries (getClosestPoint, getRandomPointAround, ...)
194
+ * The queries will try to find a solution within those bounds.
195
+ * The default is (1,1,1)
196
+ */
103
197
  setDefaultQueryExtent(extent: Vector3): void;
104
198
  }