UCrowdManager

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

AIModule

Header

/Engine/Source/Runtime/AIModule/Classes/Navigation/CrowdManager.h

Include

#include "Navigation/CrowdManager.h"

Syntax

class UCrowdManager : public UCrowdManagerBase

Variables

Name Description

Protected variable

TMap< ICrowdAge...

 

ActiveAgents

Agents registered in crowd manager

Protected variable

TArray< uint8 >

 

AgentFlags

Temporary flags for crowd agents

Protected variable

TArray< FCrowdA...

 

AvoidanceConfig

Obstacle avoidance params

Protected variable

uint32: 1

 

bAllowPathReplan

Protected variable

uint32: 1

 

bEarlyReachTestOptimization

Protected variable

uint32: 1

 

bPruneStartedOffmeshConnections

Protected variable

uint32: 1

 

bResolveCollisions

Should crowd simulation resolve collisions between agents? if not, this will be handled by their movement components

Protected variable

uint32: 1

 

bSingleAreaVisibilityOptimization

Protected variable

float

 

MaxAgentRadius

Max radius of agent that can be added to crowd

Protected variable

int32

 

MaxAgents

Max number of agents supported by crowd

Protected variable

int32

 

MaxAvoidedAgents

Max number of neighbor agents for velocity avoidance

Protected variable

int32

 

MaxAvoidedWalls

Max number of wall segments for velocity avoidance

Protected variable

TObjectPtr< ANa...

 

MyNavData

Protected variable

float

 

NavmeshCheckInterval

How often should agents check their position after moving off navmesh?

Protected variable

float

 

PathOffsetRadiusMultiplier

Agent radius multiplier for offsetting path around corners

Protected variable

float

 

PathOptimizationInterval

How often should agents try to optimize their paths?

Protected variable

TArray< FCrowdA...

 

SamplingPatterns

Obstacle avoidance params

Protected variable

float

 

SeparationDirClamp

Clamp separation force to left/right when neighbor is behind (dot between forward and dirToNei, -1 = disabled)

Protected variable

FCrowdTickHelpe...

 

TickHelper

Constructors

Name Description

Public function

UCrowdManager

(
    const FObjectInitializer& ObjectIn...
)

Functions

Name Description

Public function Const

void

 

AdjustAgentPathStart

(
    const UCrowdFollowingComponent*...,
    const FNavMeshPath* Path,
    int32& PathStartIdx
)

Adjust current position in path's corridor, starting test from PathStartIdx

Public function Const

void

 

ClearAgentMoveTarget

(
    const UCrowdFollowingComponent*...
)

Clears move target for crowd agent (only for fully simulated)

Public function Const

void

 

DebugTick()

Public function Const

bool

 

GetAvoidanceConfig

(
    int32 Idx,
    FCrowdAvoidanceConfig& Data
)

Reads existing avoidance config or returns false

Public function Static

UCrowdManage...

 

GetCurrent

(
    UWorld* World
)

Public function Static

UCrowdManage...

 

GetCurrent

(
    UObject* WorldContextObject
)

Public function Const

const ANavig...

 

GetNavData()

Public function Const

int32

 

GetNearbyAgentLocations

(
    const ICrowdAgentInterface* Ag...,
    TArray< FVector >& OutLocations
)

Returns a list of locations of nearby agents

Public function Const

int32

 

GetNumNearbyAgents

(
    const ICrowdAgentInterface* Ag...
)

Returns number of nearby agents

Public function Const

UWorld *

 

GetWorld()

Public function Const

bool

 

IsAgentValid

(
    const UCrowdFollowingComponent*...
)

Check if object is a valid crowd agent

Public function Const

bool

 

IsAgentValid

(
    const ICrowdAgentInterface* Ag...
)

Check if object is a valid crowd agent

Public function Virtual Const

bool

 

IsSuitableNavData

(
    const ANavigationData& NavData
)

Tests if NavData is a suitable nav data type to be used by this CrowdManager instance.

Public function Const

void

 

OnAgentFinishedCustomLink

(
    const ICrowdAgentInterface* Ag...
)

Update agent after using custom link

Public function

void

 

OnNavMeshUpdate()

Notify called when detour navmesh is changed

Public function Const

void

 

PauseAgent

(
    const UCrowdFollowingComponent*...
)

Switch agent to waiting state

Protected function Virtual

void

 

PostMovePointUpdate()

Called from tick, after move points were updated, before any steering/avoidance

Protected function Virtual

void

 

PostProximityUpdate()

Called from tick, just after updating agents proximity data

Public function

void

 

RegisterAgent

(
    ICrowdAgentInterface* Agent
)

Adds new agent to crowd

Public function Const

void

 

ResumeAgent

(
    const UCrowdFollowingComponent*...,
    bool bForceReplanPath
)

Resumes agent movement

Public function Const

bool

 

SetAgentMoveDirection

(
    const UCrowdFollowingComponent*...,
    const FVector& MoveDirection
)

Sets move direction for crowd agent (only for fully simulated)

Public function Const

bool

 

SetAgentMovePath

(
    const UCrowdFollowingComponent*...,
    const FNavMeshPath* Path,
    int32 PathSectionStart,
    int32 PathSectionEnd,
    const FVector& PathSectionEndLocat...
)

Sets move target using path (only for fully simulated)

Public function Const

bool

 

SetAgentMoveTarget

(
    const UCrowdFollowingComponent*...,
    const FVector& MoveTarget,
    FSharedConstNavQueryFilter Filter
)

Sets move target for crowd agent (only for fully simulated)

Public function

bool

 

SetAvoidanceConfig

(
    int32 Idx,
    const FCrowdAvoidanceConfig& Data
)

Updates existing avoidance config or returns false

Protected function

void

 

SetNavData

(
    ANavigationData* NavData,
    const bool bFindNewNavDataIfNull
)

Sets NavData as MyNavData.

Public function

void

 

SetOffmeshConnectionPruning

(
    bool bRemoveFromCorridor
)

Remove started offmesh connections from corridor

Public function

void

 

SetSingleAreaVisibilityOptimization

(
    bool bEnable
)

Block path visibility raycasts when crossing different nav areas

Public function

void

 

UnregisterAgent

(
    const ICrowdAgentInterface* Ag...
)

Removes agent from crowd

Public function Const

void

 

UpdateAgentParams

(
    const ICrowdAgentInterface* Ag...
)

Updates agent data

Public function Const

void

 

UpdateAgentState

(
    const ICrowdAgentInterface* Ag...
)

Refresh agent state

Protected function Virtual

void

 

UpdateAvoidanceConfig()

Setup params of crowd avoidance

Protected function Virtual

void

 

UpdateNavData()

Try to initialize nav data from already existing ones

Overridden from UCrowdManagerBase

Name Description

Public function Virtual

void

 

CleanUp

(
    float DeltaTime
)

Public function Virtual

void

 

OnNavDataRegistered

(
    ANavigationData& NavData
)

Called by the nav system when a new navigation data instance is registered.

Public function Virtual

void

 

OnNavDataUnregistered

(
    ANavigationData& NavData
)

Called by the nav system when a navigation data instance is removed.

Public function Virtual

void

 

Tick

(
    float DeltaTime
)

Overridden from UObject

Name Description

Public function Virtual

void

 

BeginDestroy()

Called before destroying the object.

Public function Virtual

void

 

PostEditChangeProperty

(
    FPropertyChangedEvent& PropertyCha...
)

Called when a property on this object has been modified externally