220 float m_agentPlacementHalfExtents[3];
224 float m_maxAgentRadius;
226 int m_velocitySampleCount;
230 void updateTopologyOptimization(
dtCrowdAgent** agents,
const int nagents,
const float dt);
231 void updateMoveRequest(
const float dt);
232 void checkPathValidity(
dtCrowdAgent** agents,
const int nagents,
const float dt);
234 inline int getAgentIndex(
const dtCrowdAgent* agent)
const {
return (
int)(agent - m_agents); }
236 bool requestMoveTargetReplan(
const int idx,
dtPolyRef ref,
const float* pos);
249 bool init(
const int maxAgents,
const float maxAgentRadius,
dtNavMesh* nav);
MoveRequestState
Definition: DetourCrowd.h:104
@ DT_CROWDAGENT_TARGET_WAITING_FOR_PATH
Definition: DetourCrowd.h:110
@ DT_CROWDAGENT_TARGET_NONE
Definition: DetourCrowd.h:105
@ DT_CROWDAGENT_TARGET_WAITING_FOR_QUEUE
Definition: DetourCrowd.h:109
@ DT_CROWDAGENT_TARGET_VALID
Definition: DetourCrowd.h:107
@ DT_CROWDAGENT_TARGET_REQUESTING
Definition: DetourCrowd.h:108
@ DT_CROWDAGENT_TARGET_VELOCITY
Definition: DetourCrowd.h:111
@ DT_CROWDAGENT_TARGET_FAILED
Definition: DetourCrowd.h:106
unsigned int dtPathQueueRef
Definition: DetourPathQueue.h:27
Provides local steering behaviors for a group of agents.
Definition: DetourCrowd.h:204
int getActiveAgents(dtCrowdAgent **agents, const int maxAgents)
Gets the active agents int the agent pool.
Definition: DetourCrowd.cpp:664
dtQueryFilter * getEditableFilter(const int i)
Gets the filter used by the crowd.
Definition: DetourCrowd.h:326
const dtProximityGrid * getGrid() const
Gets the crowd's proximity grid.
Definition: DetourCrowd.h:342
dtCrowd()
Definition: DetourCrowd.cpp:331
int getVelocitySampleCount() const
Gets the velocity sample count.
Definition: DetourCrowd.h:338
const float * getQueryHalfExtents() const
Gets the search halfExtents [(x, y, z)] used by the crowd for query operations.
Definition: DetourCrowd.h:330
bool init(const int maxAgents, const float maxAgentRadius, dtNavMesh *nav)
Initializes the crowd.
Definition: DetourCrowd.cpp:381
const dtObstacleAvoidanceParams * getObstacleAvoidanceParams(const int idx) const
Gets the shared avoidance configuration for the specified index.
Definition: DetourCrowd.cpp:470
bool requestMoveVelocity(const int idx, const float *vel)
Submits a new move request for the specified agent.
Definition: DetourCrowd.cpp:629
const dtPathQueue * getPathQueue() const
Gets the crowd's path request queue.
Definition: DetourCrowd.h:346
const float * getQueryExtents() const
Same as getQueryHalfExtents.
Definition: DetourCrowd.h:334
void updateAgentParameters(const int idx, const dtCrowdAgentParams *params)
Updates the specified agent's configuration.
Definition: DetourCrowd.cpp:501
bool resetMoveTarget(const int idx)
Resets any request for the specified agent.
Definition: DetourCrowd.cpp:646
int getAgentCount() const
The maximum number of agents that can be managed by the object.
Definition: DetourCrowd.cpp:477
void setObstacleAvoidanceParams(const int idx, const dtObstacleAvoidanceParams *params)
Sets the shared avoidance configuration for the specified index.
Definition: DetourCrowd.cpp:464
~dtCrowd()
Definition: DetourCrowd.cpp:346
bool requestMoveTarget(const int idx, dtPolyRef ref, const float *pos)
Submits a new move request for the specified agent.
Definition: DetourCrowd.cpp:607
dtCrowdAgent * getEditableAgent(const int idx)
Gets the specified agent from the pool.
Definition: DetourCrowd.cpp:494
void update(const float dt, dtCrowdAgentDebugInfo *debug)
Updates the steering and positions of all agents.
Definition: DetourCrowd.cpp:1046
const dtNavMeshQuery * getNavMeshQuery() const
Gets the query object used by the crowd.
Definition: DetourCrowd.h:349
const dtQueryFilter * getFilter(const int i) const
Gets the filter used by the crowd.
Definition: DetourCrowd.h:322
int addAgent(const float *pos, const dtCrowdAgentParams *params)
Adds a new agent to the crowd.
Definition: DetourCrowd.cpp:511
void removeAgent(const int idx)
Removes the agent from the crowd.
Definition: DetourCrowd.cpp:572
const dtCrowdAgent * getAgent(const int idx)
Gets the specified agent from the pool.
Definition: DetourCrowd.cpp:485
Definition: DetourLocalBoundary.h:26
Provides the ability to perform pathfinding related queries against a navigation mesh.
Definition: DetourNavMeshQuery.h:166
A navigation mesh based on tiles of convex polygons.
Definition: DetourNavMesh.h:339
Definition: DetourObstacleAvoidance.h:39
Definition: DetourObstacleAvoidance.h:98
Represents a dynamic polygon corridor used to plan agent movement.
Definition: DetourPathCorridor.h:27
Definition: DetourPathQueue.h:30
Definition: DetourProximityGrid.h:23
Defines polygon filtering and traversal costs for navigation mesh query operations.
Definition: DetourNavMeshQuery.h:36
dtCrowd * dtAllocCrowd()
Allocates a crowd object using the Detour allocator.
Definition: DetourCrowd.cpp:33
static const int DT_CROWD_MAX_QUERY_FILTER_TYPE
The maximum number of query filter types supported by the crowd manager.
Definition: DetourCrowd.h:52
CrowdAgentState
The type of navigation mesh polygon the agent is currently traversing.
Definition: DetourCrowd.h:66
static const int DT_CROWDAGENT_MAX_NEIGHBOURS
The maximum number of neighbors that a crowd agent can take into account for steering decisions.
Definition: DetourCrowd.h:32
void dtFreeCrowd(dtCrowd *ptr)
Frees the specified crowd object using the Detour allocator.
Definition: DetourCrowd.cpp:40
UpdateFlags
Crowd agent update flags.
Definition: DetourCrowd.h:186
static const int DT_CROWDAGENT_MAX_CORNERS
The maximum number of corners a crowd agent will look ahead in the path.
Definition: DetourCrowd.h:39
static const int DT_CROWD_MAX_OBSTAVOIDANCE_PARAMS
The maximum number of crowd avoidance configurations supported by the crowd manager.
Definition: DetourCrowd.h:46
@ DT_CROWDAGENT_STATE_OFFMESH
The agent is traversing an off-mesh connection.
Definition: DetourCrowd.h:69
@ DT_CROWDAGENT_STATE_WALKING
The agent is traversing a normal navigation mesh polygon.
Definition: DetourCrowd.h:68
@ DT_CROWDAGENT_STATE_INVALID
The agent is not in a valid state.
Definition: DetourCrowd.h:67
@ DT_CROWD_SEPARATION
Definition: DetourCrowd.h:189
@ DT_CROWD_OPTIMIZE_TOPO
Use dtPathCorridor::optimizePathTopology() to optimize the agent path.
Definition: DetourCrowd.h:191
@ DT_CROWD_OPTIMIZE_VIS
Use dtPathCorridor::optimizePathVisibility() to optimize the agent path.
Definition: DetourCrowd.h:190
@ DT_CROWD_OBSTACLE_AVOIDANCE
Definition: DetourCrowd.h:188
@ DT_CROWD_ANTICIPATE_TURNS
Definition: DetourCrowd.h:187
unsigned int dtPolyRef
A handle to a polygon within a navigation mesh tile.
Definition: DetourNavMesh.h:48
Definition: DetourCrowd.h:175
bool active
Definition: DetourCrowd.h:176
float initPos[3]
Definition: DetourCrowd.h:177
float tmax
Definition: DetourCrowd.h:179
float startPos[3]
Definition: DetourCrowd.h:177
dtPolyRef polyRef
Definition: DetourCrowd.h:178
float t
Definition: DetourCrowd.h:179
float endPos[3]
Definition: DetourCrowd.h:177
Definition: DetourCrowd.h:195
float optEnd[3]
Definition: DetourCrowd.h:197
dtObstacleAvoidanceDebugData * vod
Definition: DetourCrowd.h:198
float optStart[3]
Definition: DetourCrowd.h:197
int idx
Definition: DetourCrowd.h:196
Configuration parameters for a crowd agent.
Definition: DetourCrowd.h:75
void * userData
User defined data attached to the agent.
Definition: DetourCrowd.h:100
float maxSpeed
Maximum allowed speed. [Limit: >= 0].
Definition: DetourCrowd.h:79
float maxAcceleration
Maximum allowed acceleration. [Limit: >= 0].
Definition: DetourCrowd.h:78
float collisionQueryRange
Defines how close a collision element must be before it is considered for steering behaviors....
Definition: DetourCrowd.h:82
float separationWeight
How aggresive the agent manager should be at avoiding collisions with this agent. [Limit: >= 0].
Definition: DetourCrowd.h:87
unsigned char updateFlags
Flags that impact steering behavior. (See: UpdateFlags)
Definition: DetourCrowd.h:90
float height
Agent height. [Limit: > 0].
Definition: DetourCrowd.h:77
float radius
Agent radius. [Limit: >= 0].
Definition: DetourCrowd.h:76
float pathOptimizationRange
The path visibility optimization range. [Limit: > 0].
Definition: DetourCrowd.h:84
unsigned char obstacleAvoidanceType
The index of the avoidance configuration to use for the agent.
Definition: DetourCrowd.h:94
unsigned char queryFilterType
The index of the query filter used by this agent.
Definition: DetourCrowd.h:97
Represents an agent managed by a dtCrowd object.
Definition: DetourCrowd.h:117
unsigned char state
The type of mesh polygon the agent is traversing. (See: CrowdAgentState)
Definition: DetourCrowd.h:122
unsigned char cornerFlags[DT_CROWDAGENT_MAX_CORNERS]
The local path corridor corner flags. (See: dtStraightPathFlags) [(flags) * ncorners].
Definition: DetourCrowd.h:158
dtPolyRef targetRef
Target polyref of the movement request.
Definition: DetourCrowd.h:167
float targetPos[3]
Target position of the movement request (or velocity in case of DT_CROWDAGENT_TARGET_VELOCITY).
Definition: DetourCrowd.h:168
dtPathQueueRef targetPathqRef
Path finder ref.
Definition: DetourCrowd.h:169
unsigned char targetState
State of the movement request.
Definition: DetourCrowd.h:166
int nneis
The number of neighbors.
Definition: DetourCrowd.h:140
float vel[3]
The actual velocity of the agent. The change from nvel -> vel is constrained by max acceleration....
Definition: DetourCrowd.h:149
float targetReplanTime
Definition: DetourCrowd.h:171
bool targetReplan
Flag indicating that the current path is being replanned.
Definition: DetourCrowd.h:170
bool active
True if the agent is active, false if the agent is in an unused slot in the agent pool.
Definition: DetourCrowd.h:119
dtPathCorridor corridor
The path corridor the agent is using.
Definition: DetourCrowd.h:128
dtLocalBoundary boundary
The local boundary data for the agent.
Definition: DetourCrowd.h:131
float disp[3]
A temporary value used to accumulate agent displacement during iterative collision resolution....
Definition: DetourCrowd.h:146
float topologyOptTime
Time since the agent's path corridor was optimized.
Definition: DetourCrowd.h:134
int ncorners
The number of corners.
Definition: DetourCrowd.h:164
dtCrowdNeighbour neis[DT_CROWDAGENT_MAX_NEIGHBOURS]
The known neighbors of the agent.
Definition: DetourCrowd.h:137
float nvel[3]
The desired velocity adjusted by obstacle avoidance, calculated from scratch each frame....
Definition: DetourCrowd.h:148
dtPolyRef cornerPolys[DT_CROWDAGENT_MAX_CORNERS]
The reference id of the polygon being entered at the corner. [(polyRef) * ncorners].
Definition: DetourCrowd.h:161
float cornerVerts[DT_CROWDAGENT_MAX_CORNERS *3]
The local path corridor corners for the agent. (Staight path.) [(x, y, z) * ncorners].
Definition: DetourCrowd.h:155
float npos[3]
The current agent position. [(x, y, z)].
Definition: DetourCrowd.h:145
float desiredSpeed
The desired speed.
Definition: DetourCrowd.h:143
dtCrowdAgentParams params
The agent's configuration parameters.
Definition: DetourCrowd.h:152
float dvel[3]
The desired velocity of the agent. Based on the current path, calculated from scratch each frame....
Definition: DetourCrowd.h:147
bool partial
True if the agent has valid path (targetState == DT_CROWDAGENT_TARGET_VALID) and the path does not le...
Definition: DetourCrowd.h:125
Provides neighbor data for agents managed by the crowd.
Definition: DetourCrowd.h:58
int idx
The index of the neighbor in the crowd.
Definition: DetourCrowd.h:59
float dist
The distance between the current agent and the neighbor.
Definition: DetourCrowd.h:60
Definition: DetourObstacleAvoidance.h:84