Navigation
Unreal Engine C++ API Reference > Runtime > Navmesh > DetourCrowd
References
Module | Navmesh |
Header | /Engine/Source/Runtime/Navmesh/Public/DetourCrowd/DetourCrowd.h |
Include | #include "DetourCrowd/DetourCrowd.h" |
Syntax
class dtCrowd
Remarks
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 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.
Constructors
Type | Name | Description | |
---|---|---|---|
![]() |
dtCrowd () |
Destructors
Type | Name | Description | |
---|---|---|---|
![]() |
~dtCrowd () |
Functions
Type | Name | Description | |
---|---|---|---|
![]() |
int | addAgent
(
const dtReal* pos, |
Adds a new agent to the crowd. |
![]() |
int | Cache list of active agents | |
![]() ![]() |
dtCrowdAgent ** | Gets all cached active agents. | |
![]() |
int | getActiveAgents
(
dtCrowdAgent** agents, |
Gets the active agents int the agent pool. |
![]() |
const dtCrowdAgent * | getAgent
(
const int idx |
Gets the specified agent from the pool. |
![]() ![]() |
const dtCrowdAgentAnimation * | Gets all agent animations. | |
![]() ![]() |
const int | The maximum number of agents that can be managed by the object. | |
![]() ![]() |
int | getAgentIndex
(
const dtCrowdAgent* agent |
|
![]() |
dtQueryFilter * | getEditableFilter
(
const int idx |
Gets the filter used by the crowd. |
![]() ![]() |
const dtQueryFilter * | getFilter
(
const int idx |
Gets the filter used by the crowd. |
![]() ![]() |
const dtProximityGrid * | getGrid () |
Gets the crowd's proximity grid. |
![]() ![]() |
const dtNavMeshQuery * | Gets the query object used by the crowd. | |
![]() ![]() |
int | ||
![]() ![]() |
const dtObstacleAvoidanceParams * | getObstacleAvoidanceParams
(
const int idx |
Gets the shared avoidance configuration for the specified index. |
![]() |
bool | getObstacleAvoidancePattern
(
int idx, |
[UE] Gets the shared avoidance sampling pattern for the specified index. |
![]() ![]() |
const dtPathQueue * | getPathQueue () |
Gets the crowd's path request queue. |
![]() ![]() |
const dtReal * | Gets the search extents [(x, y, z)] used by the crowd for query operations. | |
![]() ![]() |
const dtSharedBoundary * | Gets shared boundary cache. | |
![]() ![]() |
int | Gets the velocity sample count. | |
![]() |
bool | Initializes the crowd. May be called more than once to purge and re-initialize the crowd. | |
![]() |
bool | initAvoidance
(
const int maxNeighbors, |
[UE] Initializes the avoidance query. |
![]() ![]() |
bool | isOutsideCorridor
(
const int idx |
[UE] 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, |
Submits a new move request for the specified agent. |
![]() |
bool | requestMoveVelocity
(
const int idx, |
Submits a new move request for the specified agent. |
![]() |
bool | resetAgentVelocity
(
const int idx |
[UE] Resets agent's velocity |
![]() |
bool | resetMoveTarget
(
const int idx |
Resets any request for the specified agent. |
![]() |
bool | setAgentBackOnLink
(
const int idx |
[UE] Switch to offmesh link state |
![]() |
void | setAgentCheckInterval
(
const dtReal t |
[UE] Set time between attempts to restore agents state |
![]() |
bool | setAgentCorridor
(
const int idx, |
[UE] 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 |
[UE] Switch to waiting state |
![]() |
void | setEarlyReachTestOptimization
(
bool bEnable |
[UE] |
![]() |
void | setObstacleAvoidanceParams
(
const int idx, |
Sets the shared avoidance configuration for the specified index. |
![]() |
void | setObstacleAvoidancePattern
(
int idx, |
[UE] Sets the shared avoidance sampling pattern for the specified index. |
![]() |
void | setPathOffsetRadiusMultiplier
(
dtReal RadiusMultiplier |
[UE] Set agent radius multiplier for offseting path from corners |
![]() |
void | setPruneStartedOffmeshConnections
(
bool bRemoveFromCorridor |
[UE] 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
(
dtReal InFilter |
[UE] Set separation filter param |
![]() |
void | setSingleAreaVisibilityOptimization
(
bool bEnable |
[UE] 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 dtReal dt, |
Updates the steering and positions of all agents. |
![]() |
bool | updateAgentFilter
(
const int idx, |
[UE] Updates the specified agent's query filter. |
![]() |
void | updateAgentParameters
(
const int idx, |
Updates the specified agent's configuration. |
![]() |
void | updateAgentState
(
const int idx, |
[UE] Refresh state of agent, used after completing movement through offmesh links |
![]() |
void | updateStepAvoidance
(
const dtReal dt, |
[UE] Split update into several smaller components: avoidance |
![]() |
void | updateStepCorridor
(
const dtReal dt, |
[UE] Split update into several smaller components: corridor updates at new position |
![]() |
void | updateStepMove
(
const dtReal dt, |
[UE] Split update into several smaller components: integrate velocities and handle collisions |
![]() |
void | updateStepNextMovePoint
(
const dtReal dt, |
[UE] Split update into several smaller components: next corner for move, trigger offmesh links |
![]() |
void | updateStepOffMeshAnim
(
const dtReal dt, |
[UE] Split update into several smaller components: offmesh anims |
![]() |
void | updateStepOffMeshVelocity
(
const dtReal dt, |
[UE] Split update into several smaller components: offmesh link velocity (instead of playing animation) |
![]() |
void | updateStepPaths
(
const dtReal dt, |
[UE] Split update into several smaller components: path validity, path cache and path optimizations |
![]() |
void | updateStepProximityData
(
const dtReal dt, |
[UE] Split update into several smaller components: neighbors and boundaries |
![]() |
void | updateStepSteering
(
const dtReal dt, |
[UE] Split update into several smaller components: steering |
See Also
dtAllocCrowd()
dtFreeCrowd()