Module |
|
Header |
/Engine/Source/Runtime/Navmesh/Public/DetourCrowd/DetourCrowd.h |
Include |
#include "DetourCrowd/DetourCrowd.h" |
class dtCrowd
Provides local steering behaviors for a group of agents.
This is the core class of the Crowd module. See the Crowd documentation for a summary of the crowd features.
A common method for setting up the crowd is as follows:
Allocate the crowd using dtAllocCrowd.
Initialize the crowd using init().
Set the avoidance configurations using setObstacleAvoidanceParams().
Add agents using addAgent() and make an initial movement request using requestMoveTarget().
A common process for managing the crowd is as follows:
Call update() to allow the crowd to manage its agents.
Retrieve agent information using getActiveAgents().
Make movement requests using requestMoveTarget() when movement goal changes.
Repeat every frame.
Some agent configuration settings can be updated using updateAgentParameters(). But the crowd owns the agent position. So it is not possible to update an active agent's position. If agent position must be fed back into the crowd, the agent must be removed and re-added.
Notes:
Path related information is available for newly added agents only after an update() has been performed.
Agent objects are kept in a pool and re-used. So it is important when using agent objects to check the value of [dtCrowdAgent::active](API\Runtime\Navmesh\DetourCrowd\dtCrowdAgent\active) to determine if the agent is actually in use or not.
This class is meant to provide 'local' movement. There is a limit of 256 polygons in the path corridor. So it is not meant to provide automatic pathfinding services over long distances.
Name | Description | |
---|---|---|
|
dtCrowd() |
Name | Description | |
---|---|---|
|
~dtCrowd() |
Name | Description | ||
---|---|---|---|
|
int |
addAgent ( |
Adds a new agent to the crowd. |
|
int |
cacheActiveAgents() |
Cache list of active agents |
|
dtCrowdAgent... |
getActiveAgents() |
Gets all cached active agents. |
|
int |
getActiveAgents ( |
Gets the active agents int the agent pool. |
|
const dtCrow... |
getAgent ( |
Gets the specified agent from the pool. |
|
const dtCrow... |
getAgentAnims() |
Gets all agent animations. |
|
const int |
getAgentCount() |
The maximum number of agents that can be managed by the object. |
|
int |
getAgentIndex ( |
|
|
dtQueryFilte... |
getEditableFilter ( |
Gets the filter used by the crowd. |
|
const dtQuer... |
getFilter ( |
Gets the filter used by the crowd. |
|
const dtProx... |
getGrid() |
Gets the crowd's proximity grid. |
|
const dtNavM... |
getNavMeshQuery() |
Gets the query object used by the crowd. |
|
int |
getNumActiveAgents() |
|
|
const dtObst... |
getObstacleAvoidanceParams ( |
Gets the shared avoidance configuration for the specified index. |
|
getObstacleAvoidancePattern ( |
[UE4] Gets the shared avoidance sampling pattern for the specified index. |
|
|
const dtPath... |
getPathQueue() |
Gets the crowd's path request queue. |
|
const float ... |
getQueryExtents() |
Gets the search extents [(x, y, z)] used by the crowd for query operations. |
|
const dtShar... |
getSharedBoundary() |
Gets shared boundary cache. |
|
int |
getVelocitySampleCount() |
Gets the velocity sample count. |
|
init ( |
Initializes the crowd. May be called more than once to purge and re-initialize the crowd. |
|
|
initAvoidance ( |
[UE4] Initializes the avoidance query. |
|
|
isOutsideCorridor ( |
[UE4] Check if agent moved away from its path corridor |
|
|
removeAgent ( |
Removes the agent from the crowd. |
|
|
requestMoveTarget ( |
Submits a new move request for the specified agent. |
|
|
requestMoveVelocity ( |
Submits a new move request for the specified agent. |
|
|
resetAgentVelocity ( |
[UE4] Resets agent's velocity |
|
|
resetMoveTarget ( |
Resets any request for the specified agent. |
|
|
setAgentBackOnLink ( |
[UE4] Switch to offmesh link state |
|
|
setAgentCheckInterval ( |
[UE4] Set time between attempts to restore agents state |
|
|
setAgentCorridor ( |
[UE4] Set agent corridor, works only just after requesting move target when agent didn't start any pathfinding operations yet Use with caution! |
|
|
setAgentWaiting ( |
[UE4] Switch to waiting state |
|
|
setEarlyReachTestOptimization ( |
[UE4] |
|
|
setObstacleAvoidanceParams ( |
Sets the shared avoidance configuration for the specified index. |
|
|
setObstacleAvoidancePattern ( |
[UE4] Sets the shared avoidance sampling pattern for the specified index. |
|
|
setPathOffsetRadiusMultiplier ( |
[UE4] Set agent radius multiplier for offseting path from corners |
|
|
setPruneStartedOffmeshConnections ( |
[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) |
|
|
setSeparationFilter ( |
[UE4] Set separation filter param |
|
|
setSingleAreaVisibilityOptimization ( |
[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 |
|
|
update ( |
Updates the steering and positions of all agents. |
|
|
updateAgentFilter ( |
[UE4] Updates the specified agent's query filter. |
|
|
updateAgentParameters ( |
Updates the specified agent's configuration. |
|
|
updateAgentState ( |
[UE4] Refresh state of agent, used after completing movement through offmesh links |
|
|
updateStepAvoidance ( |
[UE4] Split update into several smaller components: avoidance |
|
|
updateStepCorridor ( |
[UE4] Split update into several smaller components: corridor updates at new position |
|
|
updateStepMove ( |
[UE4] Split update into several smaller components: integrate velocities and handle collisions |
|
|
updateStepNextMovePoint ( |
[UE4] Split update into several smaller components: next corner for move, trigger offmesh links |
|
|
updateStepOffMeshAnim ( |
[UE4] Split update into several smaller components: offmesh anims |
|
|
updateStepOffMeshVelocity ( |
[UE4] Split update into several smaller components: offmesh link velocity (instead of playing animation) |
|
|
updateStepPaths ( |
[UE4] Split update into several smaller components: path validity, path cache and path optimizations |
|
|
updateStepProximityData ( |
[UE4] Split update into several smaller components: neighbors and boundaries |
|
|
updateStepSteering ( |
[UE4] Split update into several smaller components: steering |