UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
Crowd

Classes

struct  dtCrowdNeighbour
 
struct  dtCrowdAgentParams
 
struct  dtCrowdAgent
 
class  dtCrowd
 
class  dtPathCorridor
 

Enumerations

enum  CrowdAgentState { DT_CROWDAGENT_STATE_INVALID , DT_CROWDAGENT_STATE_WALKING , DT_CROWDAGENT_STATE_OFFMESH , DT_CROWDAGENT_STATE_WAITING }
 
enum  UpdateFlags {
  DT_CROWD_ANTICIPATE_TURNS = 1 << 0 , DT_CROWD_OBSTACLE_AVOIDANCE = 1 << 1 , DT_CROWD_SEPARATION = 1 << 2 , DT_CROWD_OPTIMIZE_VIS = 1 << 3 ,
  DT_CROWD_OPTIMIZE_TOPO = 1 << 4 , DT_CROWD_OPTIMIZE_VIS_MULTI = 1 << 5 , DT_CROWD_OFFSET_PATH = 1 << 6 , DT_CROWD_SLOWDOWN_AT_GOAL = 1 << 7
}
 

Functions

NAVMESH_API dtCrowddtAllocCrowd ()
 
NAVMESH_API void dtFreeCrowd (dtCrowd *ptr)
 

Detailed Description

Members in this module implement local steering and dynamic avoidance features.

The crowd is the big beast of the navigation features. It not only handles a lot of the path management for you, but also local steering and dynamic avoidance between members of the crowd. I.e. It can keep your agents from running into each other.

Main class: dtCrowd

The dtNavMeshQuery and dtPathCorridor classes provide perfectly good, easy to use path planning features. But in the end they only give you points that your navigation client should be moving toward. When it comes to deciding things like agent velocity and steering to avoid other agents, that is up to you to implement. Unless, of course, you decide to use dtCrowd.

Basically, you add an agent to the crowd, providing various configuration settings such as maximum speed and acceleration. You also provide a local target to more toward. The crowd manager then provides, with every update, the new agent position and velocity for the frame. The movement will be constrained to the navigation mesh, and steering will be applied to ensure agents managed by the crowd do not collide with each other.

This is very powerful feature set. But it comes with limitations.

The biggest limitation is that you must give control of the agent's position completely over to the crowd manager. You can update things like maximum speed and acceleration. But in order for the crowd manager to do its thing, it can't allow you to constantly be giving it overrides to position and velocity. So you give up direct control of the agent's movement. It belongs to the crowd.

The second biggest limitation revolves around the fact that the crowd manager deals with local planning. So the agent's target should never be more than 256 polygons aways from its current position. If it is, you risk your agent failing to reach its target. So you may still need to do long distance planning and provide the crowd manager with intermediate targets.

Other significant limitations:

Note
This is a summary list of members. Use the index or search feature to find minor members.

Enumeration Type Documentation

◆ CrowdAgentState

The type of navigation mesh polygon the agent is currently traversing.

Enumerator
DT_CROWDAGENT_STATE_INVALID 

The agent is not in a valid state.

DT_CROWDAGENT_STATE_WALKING 

The agent is traversing a normal navigation mesh polygon.

DT_CROWDAGENT_STATE_OFFMESH 

The agent is traversing an off-mesh connection.

DT_CROWDAGENT_STATE_WAITING 

[UE] The agent is waiting for external movement to finish

◆ UpdateFlags

Crowd agent update flags.

See also
dtCrowdAgentParams::updateFlags
Enumerator
DT_CROWD_ANTICIPATE_TURNS 
DT_CROWD_OBSTACLE_AVOIDANCE 
DT_CROWD_SEPARATION 
DT_CROWD_OPTIMIZE_VIS 

Use dtPathCorridor::optimizePathVisibility() to optimize the agent path.

DT_CROWD_OPTIMIZE_TOPO 

Use dtPathCorridor::optimizePathTopology() to optimize the agent path.

DT_CROWD_OPTIMIZE_VIS_MULTI 

[UE] Multiple calls for optimizePathVisibility instead of checking last point

DT_CROWD_OFFSET_PATH 

[UE] Offset path points from corners by agent radius

DT_CROWD_SLOWDOWN_AT_GOAL 

[UE] Slowdown before reaching goal

Function Documentation

◆ dtAllocCrowd()

NAVMESH_API dtCrowd * dtAllocCrowd ( )

Allocates a crowd object using the Detour allocator.

Returns
A crowd object that is ready for initialization, or null on failure.

◆ dtFreeCrowd()

NAVMESH_API void dtFreeCrowd ( dtCrowd ptr)

Frees the specified crowd object using the Detour allocator.

Parameters
[in]ptrA crowd object allocated using dtAllocCrowd