Provides local steering behaviors for a group of agents. 更多...
#include <DetourCrowd.h>
Public 成员函数 | |
| int | addAgent (const float *pos, const dtCrowdAgentParams ¶ms, const dtQueryFilter *filter) |
| Adds a new agent to the crowd. 更多... | |
| int | cacheActiveAgents () |
| Cache list of active agents 更多... | |
| dtCrowdAgent ** | getActiveAgents () const |
| Gets all cached active agents | |
| int | getActiveAgents (dtCrowdAgent **agents, const int maxAgents) |
| Gets the active agents int the agent pool. 更多... | |
| const dtCrowdAgent * | getAgent (const int idx) |
| Gets the specified agent from the pool. 更多... | |
| const dtCrowdAgentAnimation * | getAgentAnims () const |
| Gets all agent animations | |
| const int | getAgentCount () const |
| The maximum number of agents that can be managed by the object. 更多... | |
| dtQueryFilter * | getEditableFilter (const int idx) |
| Gets the filter used by the crowd. 更多... | |
| const dtQueryFilter * | getFilter (const int idx) const |
| Gets the filter used by the crowd. 更多... | |
| const dtProximityGrid * | getGrid () const |
| Gets the crowd's proximity grid. 更多... | |
| const dtNavMeshQuery * | getNavMeshQuery () const |
| Gets the query object used by the crowd. | |
| const dtObstacleAvoidanceParams * | getObstacleAvoidanceParams (const int idx) const |
| Gets the shared avoidance configuration for the specified index. 更多... | |
| bool | getObstacleAvoidancePattern (int idx, float *angles, float *radii, int *nsamples) |
| [UE4] Gets the shared avoidance sampling pattern for the specified index. 更多... | |
| const dtPathQueue * | getPathQueue () const |
| Gets the crowd's path request queue. 更多... | |
| const float * | getQueryExtents () const |
| Gets the search extents [(x, y, z)] used by the crowd for query operations. 更多... | |
| const dtSharedBoundary * | getSharedBoundary () const |
| Gets shared boundary cache | |
| int | getVelocitySampleCount () const |
| Gets the velocity sample count. 更多... | |
| bool | init (const int maxAgents, const float maxAgentRadius, dtNavMesh *nav) |
| Initializes the crowd. 更多... | |
| bool | initAvoidance (const int maxNeighbors, const int maxWalls, const int maxCustomPatterns) |
| [UE4] Initializes the avoidance query. 更多... | |
| bool | isOutsideCorridor (const int idx) const |
| [UE4] Check if agent moved away from its path corridor | |
| void | removeAgent (const int idx) |
| Removes the agent from the crowd. 更多... | |
| bool | requestMoveTarget (const int idx, dtPolyRef ref, const float *pos) |
| Submits a new move request for the specified agent. 更多... | |
| bool | requestMoveVelocity (const int idx, const float *vel) |
| Submits a new move request for the specified agent. 更多... | |
| bool | resetAgentVelocity (const int idx) |
| [UE4] Resets agent's velocity 更多... | |
| bool | resetMoveTarget (const int idx) |
| Resets any request for the specified agent. 更多... | |
| bool | setAgentBackOnLink (const int idx) |
| [UE4] Switch to offmesh link state 更多... | |
| void | setAgentCheckInterval (const float t) |
| [UE4] Set time between attempts to restore agents state 更多... | |
| bool | setAgentCorridor (const int idx, const dtPolyRef *path, const int npath) |
| [UE4] Set agent corridor, works only just after requesting move target when agent didn't start any pathfinding operations yet Use with caution! 更多... | |
| bool | setAgentWaiting (const int idx) |
| [UE4] Switch to waiting state 更多... | |
| void | setEarlyReachTestOptimization (bool bEnable) |
| [UE4] | |
| void | setObstacleAvoidanceParams (const int idx, const dtObstacleAvoidanceParams *params) |
| Sets the shared avoidance configuration for the specified index. 更多... | |
| void | setObstacleAvoidancePattern (int idx, const float *angles, const float *radii, int nsamples) |
| [UE4] Sets the shared avoidance sampling pattern for the specified index. 更多... | |
| void | setPathOffsetRadiusMultiplier (float RadiusMultiplier) |
| [UE4] Set agent radius multiplier for offseting path from corners | |
| void | setPruneStartedOffmeshConnections (bool bRemoveFromCorridor) |
| [UE4] Set offmesh connection pruning This will allow removing offmesh connection poly ref from corridor as soon as offmesh connection anim is triggered (default behavior) | |
| void | setSeparationFilter (float InFilter) |
| [UE4] Set separation filter param | |
| void | setSingleAreaVisibilityOptimization (bool bEnable) |
| [UE4] Set visibility optimization to use single area raycasts This will prevent from cutting through polys marked as different area which could have been avoided in corridor's path 更多... | |
| void | update (const float dt, dtCrowdAgentDebugInfo *debug) |
| Updates the steering and positions of all agents. 更多... | |
| bool | updateAgentFilter (const int idx, const dtQueryFilter *filter) |
| [UE4] Updates the specified agent's query filter. 更多... | |
| void | updateAgentParameters (const int idx, const dtCrowdAgentParams ¶ms) |
| Updates the specified agent's configuration. 更多... | |
| void | updateAgentState (const int idx, bool repath) |
| [UE4] Refresh state of agent, used after completing movement through offmesh links 更多... | |
| void | updateStepAvoidance (const float dt, dtCrowdAgentDebugInfo *debug) |
| [UE4] Split update into several smaller components: avoidance 更多... | |
| void | updateStepCorridor (const float dt, dtCrowdAgentDebugInfo *debug) |
| [UE4] Split update into several smaller components: corridor updates at new position 更多... | |
| void | updateStepMove (const float dt, dtCrowdAgentDebugInfo *debug) |
| [UE4] Split update into several smaller components: integrate velocities and handle collisions 更多... | |
| void | updateStepNextMovePoint (const float dt, dtCrowdAgentDebugInfo *debug) |
| [UE4] Split update into several smaller components: next corner for move, trigger offmesh links 更多... | |
| void | updateStepOffMeshAnim (const float dt, dtCrowdAgentDebugInfo *debug) |
| [UE4] Split update into several smaller components: offmesh anims 更多... | |
| void | updateStepOffMeshVelocity (const float dt, dtCrowdAgentDebugInfo *debug) |
| [UE4] Split update into several smaller components: offmesh link velocity (instead of playing animation) 更多... | |
| void | updateStepPaths (const float dt, dtCrowdAgentDebugInfo *debug) |
| [UE4] Split update into several smaller components: path validity, path cache and path optimizations 更多... | |
| void | updateStepProximityData (const float dt, dtCrowdAgentDebugInfo *debug) |
| [UE4] Split update into several smaller components: neighbors and boundaries 更多... | |
| void | updateStepSteering (const float dt, dtCrowdAgentDebugInfo *debug) |
| [UE4] Split update into several smaller components: steering 更多... | |
Provides local steering behaviors for a group of agents.
| int dtCrowd::addAgent | ( | const float * | pos, |
| const dtCrowdAgentParams & | params, | ||
| const dtQueryFilter * | filter | ||
| ) |
Adds a new agent to the crowd.
| [in] | pos | The requested position of the agent. [(x, y, z)] |
| [in] | params | The configutation of the agent. |
| [in] | filter | [UE4] query filter used by agent |
| int dtCrowd::cacheActiveAgents | ( | ) |
Cache list of active agents
| int dtCrowd::getActiveAgents | ( | dtCrowdAgent ** | agents, |
| const int | maxAgents | ||
| ) |
Gets the active agents int the agent pool.
| [out] | agents | An array of agent pointers. [(dtCrowdAgent *) * maxAgents] |
| [in] | maxAgents | The size of the crowd agent array. |
agents. | const dtCrowdAgent * dtCrowd::getAgent | ( | const int | idx | ) |
Gets the specified agent from the pool.
| [in] | idx | The agent index. [Limits: 0 <= value < getAgentCount()] |
| const int dtCrowd::getAgentCount | ( | ) | const |
The maximum number of agents that can be managed by the object.
| dtQueryFilter * dtCrowd::getEditableFilter | ( | const int | idx | ) |
Gets the filter used by the crowd.
| [in] | idx | [UE4] The agent index. [Limits: 0 <= value < getAgentCount()] |
| const dtQueryFilter * dtCrowd::getFilter | ( | const int | idx | ) | const |
Gets the filter used by the crowd.
| [in] | idx | [UE4] The agent index. [Limits: 0 <= value < getAgentCount()] |
|
inline |
Gets the crowd's proximity grid.
| const dtObstacleAvoidanceParams * dtCrowd::getObstacleAvoidanceParams | ( | const int | idx | ) | const |
Gets the shared avoidance configuration for the specified index.
| [in] | idx | The index of the configuration to retreive. [Limits: 0 <= value < DT_CROWD_MAX_OBSTAVOIDANCE_PARAMS] |
| bool dtCrowd::getObstacleAvoidancePattern | ( | int | idx, |
| float * | angles, | ||
| float * | radii, | ||
| int * | nsamples | ||
| ) |
[UE4] Gets the shared avoidance sampling pattern for the specified index.
| [in] | idx | The index. |
| [in] | angles | radians from direction of desired velocity [Count: nsamples] |
| [in] | radii | normalized radii (0..1) for each sample [Count: nsamples] |
| [in] | nsamples | The number of samples |
|
inline |
Gets the crowd's path request queue.
|
inline |
Gets the search extents [(x, y, z)] used by the crowd for query operations.
|
inline |
Gets the velocity sample count.
| bool dtCrowd::init | ( | const int | maxAgents, |
| const float | maxAgentRadius, | ||
| dtNavMesh * | nav | ||
| ) |
Initializes the crowd.
| [in] | maxAgents | The maximum number of agents the crowd can manage. [Limit: >= 1] |
| [in] | maxAgentRadius | The maximum radius of any agent that will be added to the crowd. [Limit: > 0] |
| [in] | nav | The navigation mesh to use for planning. |
| bool dtCrowd::initAvoidance | ( | const int | maxNeighbors, |
| const int | maxWalls, | ||
| const int | maxCustomPatterns | ||
| ) |
[UE4] Initializes the avoidance query.
| [in] | maxNeighbors | The maximum number of processed neighbors |
| [in] | maxWalls | The maximum number of processed wall segments |
| [in] | maxCustomPatterns | The maximum number of custom sampling patterns |
| void dtCrowd::removeAgent | ( | const int | idx | ) |
Removes the agent from the crowd.
| [in] | idx | The agent index. [Limits: 0 <= value < getAgentCount()] |
| bool dtCrowd::requestMoveTarget | ( | const int | idx, |
| dtPolyRef | ref, | ||
| const float * | pos | ||
| ) |
Submits a new move request for the specified agent.
| [in] | idx | The agent index. [Limits: 0 <= value < getAgentCount()] |
| [in] | ref | The position's polygon reference. |
| [in] | pos | The position within the polygon. [(x, y, z)] |
| bool dtCrowd::requestMoveVelocity | ( | const int | idx, |
| const float * | vel | ||
| ) |
Submits a new move request for the specified agent.
| [in] | idx | The agent index. [Limits: 0 <= value < getAgentCount()] |
| [in] | vel | The movement velocity. [(x, y, z)] |
| bool dtCrowd::resetAgentVelocity | ( | const int | idx | ) |
[UE4] Resets agent's velocity
| [in] | idx | The agent index. [Limits: 0 <= value < getAgentCount()] |
| bool dtCrowd::resetMoveTarget | ( | const int | idx | ) |
Resets any request for the specified agent.
| [in] | idx | The agent index. [Limits: 0 <= value < getAgentCount()] |
| bool dtCrowd::setAgentBackOnLink | ( | const int | idx | ) |
[UE4] Switch to offmesh link state
| [in] | idx | The agent index. [Limits: 0 <= value < getAgentCount()] |
| void dtCrowd::setAgentCheckInterval | ( | const float | t | ) |
[UE4] Set time between attempts to restore agents state
| [in] | t | Time in seconds |
| bool dtCrowd::setAgentCorridor | ( | const int | idx, |
| const dtPolyRef * | path, | ||
| const int | npath | ||
| ) |
[UE4] Set agent corridor, works only just after requesting move target when agent didn't start any pathfinding operations yet Use with caution!
| [in] | idx | The agent index. [Limits: 0 <= value < getAgentCount()] |
| [in] | path | The path corridor. [(polyRef) * npolys] |
| [in] | npath | The number of polygons in the path. |
| bool dtCrowd::setAgentWaiting | ( | const int | idx | ) |
[UE4] Switch to waiting state
| [in] | idx | The agent index. [Limits: 0 <= value < getAgentCount()] |
| void dtCrowd::setObstacleAvoidanceParams | ( | const int | idx, |
| const dtObstacleAvoidanceParams * | params | ||
| ) |
Sets the shared avoidance configuration for the specified index.
| [in] | idx | The index. [Limits: 0 <= value < DT_CROWD_MAX_OBSTAVOIDANCE_PARAMS] |
| [in] | params | The new configuration. |
| void dtCrowd::setObstacleAvoidancePattern | ( | int | idx, |
| const float * | angles, | ||
| const float * | radii, | ||
| int | nsamples | ||
| ) |
[UE4] Sets the shared avoidance sampling pattern for the specified index.
| [in] | idx | The index. |
| [in] | angles | radians from direction of desired velocity [Count: nsamples] |
| [in] | radii | normalized radii (0..1) for each sample [Count: nsamples] |
| [in] | nsamples | The number of samples |
| void dtCrowd::setSingleAreaVisibilityOptimization | ( | bool | bEnable | ) |
[UE4] Set visibility optimization to use single area raycasts This will prevent from cutting through polys marked as different area which could have been avoided in corridor's path
| [in] | bEnable | New state of single area raycast mode |
| void dtCrowd::update | ( | const float | dt, |
| dtCrowdAgentDebugInfo * | debug | ||
| ) |
Updates the steering and positions of all agents.
| [in] | dt | The time, in seconds, to update the simulation. [Limit: > 0] |
| [out] | debug | A debug object to load with debug information. [Opt] |
| bool dtCrowd::updateAgentFilter | ( | const int | idx, |
| const dtQueryFilter * | filter | ||
| ) |
[UE4] Updates the specified agent's query filter.
| [in] | idx | The agent index. [Limits: 0 <= value < getAgentCount()] |
| [in] | filter | The new filter. |
| void dtCrowd::updateAgentParameters | ( | const int | idx, |
| const dtCrowdAgentParams & | params | ||
| ) |
Updates the specified agent's configuration.
| [in] | idx | The agent index. [Limits: 0 <= value < getAgentCount()] |
| [in] | params | The new agent configuration. |
| void dtCrowd::updateAgentState | ( | const int | idx, |
| bool | repath | ||
| ) |
[UE4] Refresh state of agent, used after completing movement through offmesh links
| [in] | idx | The agent index. [Limits: 0 <= value < getAgentCount()] |
| [in] | repath | If set, agent will invalidate its path |
| void dtCrowd::updateStepAvoidance | ( | const float | dt, |
| dtCrowdAgentDebugInfo * | debug | ||
| ) |
[UE4] Split update into several smaller components: avoidance
| [in] | dt | Delta time in seconds |
| [in] | nagents | Number of active agents |
| void dtCrowd::updateStepCorridor | ( | const float | dt, |
| dtCrowdAgentDebugInfo * | debug | ||
| ) |
[UE4] Split update into several smaller components: corridor updates at new position
| [in] | dt | Delta time in seconds |
| [in] | nagents | Number of active agents |
| void dtCrowd::updateStepMove | ( | const float | dt, |
| dtCrowdAgentDebugInfo * | debug | ||
| ) |
[UE4] Split update into several smaller components: integrate velocities and handle collisions
| [in] | dt | Delta time in seconds |
| [in] | nagents | Number of active agents |
| void dtCrowd::updateStepNextMovePoint | ( | const float | dt, |
| dtCrowdAgentDebugInfo * | debug | ||
| ) |
[UE4] Split update into several smaller components: next corner for move, trigger offmesh links
| [in] | dt | Delta time in seconds |
| [in] | nagents | Number of active agents |
| void dtCrowd::updateStepOffMeshAnim | ( | const float | dt, |
| dtCrowdAgentDebugInfo * | debug | ||
| ) |
[UE4] Split update into several smaller components: offmesh anims
| [in] | dt | Delta time in seconds |
| [in] | nagents | Number of active agents |
| void dtCrowd::updateStepOffMeshVelocity | ( | const float | dt, |
| dtCrowdAgentDebugInfo * | debug | ||
| ) |
[UE4] Split update into several smaller components: offmesh link velocity (instead of playing animation)
| [in] | dt | Delta time in seconds |
| [in] | nagents | Number of active agents |
| void dtCrowd::updateStepPaths | ( | const float | dt, |
| dtCrowdAgentDebugInfo * | debug | ||
| ) |
[UE4] Split update into several smaller components: path validity, path cache and path optimizations
| [in] | dt | Delta time in seconds |
| [in] | nagents | Number of active agents |
| void dtCrowd::updateStepProximityData | ( | const float | dt, |
| dtCrowdAgentDebugInfo * | debug | ||
| ) |
[UE4] Split update into several smaller components: neighbors and boundaries
| [in] | dt | Delta time in seconds |
| [in] | nagents | Number of active agents |
| void dtCrowd::updateStepSteering | ( | const float | dt, |
| dtCrowdAgentDebugInfo * | debug | ||
| ) |
[UE4] Split update into several smaller components: steering
| [in] | dt | Delta time in seconds |
| [in] | nagents | Number of active agents |