UCrowdFollowingComponent

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

AIModule

Header

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

Include

#include "Navigation/CrowdFollowingComponent.h"

Syntax

class UCrowdFollowingComponent :
    public UPathFollowingComponent,
    public ICrowdAgentInterface

Variables

Name Description

Protected variable

TEnumAsByte< EC...

 

AvoidanceQuality

Protected variable

float

 

AvoidanceRangeMultiplier

Multiplier for avoidance samples during detection, doesn't affect actual velocity

Protected variable

uint8: 1

 

bAffectFallingVelocity

If set, velocity will be updated even if agent is falling

Protected variable

uint8: 1

 

bCanCheckMovingTooFar

If set, destination overshot can be tested

Protected variable

uint8: 1

 

bCanUpdatePathPartInTick

If set, path parts can be switched in UpdatePathSegment, based on distance

Protected variable

uint8: 1

 

bCheckMovementAngle

If set, movement will be finished when velocity is opposite to path direction (runtime flag)

Protected variable

uint8: 1

 

bEnableAnticipateTurns

Protected variable

uint8: 1

 

bEnableObstacleAvoidance

Protected variable

uint8: 1

 

bEnableOptimizeTopology

Protected variable

uint8: 1

 

bEnableOptimizeVisibility

Protected variable

uint8: 1

 

bEnablePathOffset

Protected variable

uint8: 1

 

bEnableSeparation

Protected variable

uint8: 1

 

bEnableSimulationReplanOnResume

Protected variable

uint8: 1

 

bEnableSlowdownAtGoal

Protected variable

uint8: 1

 

bFinalPathPart

If set, agent if moving on final path part, skip further updates (runtime flag)

Protected variable

uint8: 1

 

bRegisteredWithCrowdSimulation

Set when agent is registered in crowd simulation (either controlled or an obstacle)

Protected variable

uint8: 1

 

bRotateToVelocity

If set, move focus will match velocity direction

Protected variable

uint8: 1

 

bSuspendCrowdSimulation

If set, avoidance and steering will be suspended (used for direct move requests)

Protected variable

uint8: 1

 

bUpdateDirectMoveVelocity

If set, move velocity will be updated in every tick

Protected variable

UCharacterMovem...

 

CharacterMovement

Protected variable

float

 

CollisionQueryRange

Public variable

FVector

 

CrowdAgentMoveDirection

Protected variable

int32

 

LastPathPolyIndex

Last visited poly on path

Protected variable

float

 

PathOptimizationRange

Protected variable

int32

 

PathStartIndex

Start index of current path part

Protected variable

float

 

SeparationWeight

Protected variable

ECrowdSimulatio...

 

SimulationState

Protected variable

friend

 

UCrowdManager

Constructors

Name Description

Public function

UCrowdFollowingComponent

(
    const FObjectInitializer& ObjectIn...
)

Functions

Name Description

Public function Virtual

void

 

ApplyCrowdAgentPosition

(
    const FVector& NewPosition
)

Pass desired position to movement component (after resolving collisions between crowd agents)

Public function Virtual

void

 

ApplyCrowdAgentVelocity

(
    const FVector& NewVelocity,
    const FVector& DestPathCorner,
    bool bTraversingLink
)

Public function Virtual

void

 

ApplyCrowdAgentVelocity

(
    const FVector& NewVelocity,
    const FVector& DestPathCorner,
    bool bTraversingLink,
    bool bIsNearEndOfPath
)

Pass agent velocity to movement component

Public function Const

int32

 

GetAvoidanceGroup()

Public function Const

ECrowdAvoida...

 

GetCrowdAvoidanceQuality()

Public function Const

float

 

GetCrowdAvoidanceRangeMultiplier()

Public function Const

float

 

GetCrowdCollisionQueryRange()

Public function Const

float

 

GetCrowdPathOptimizationRange()

Public function Const

float

 

GetCrowdSeparationWeight()

Public function Const

ECrowdSimula...

 

GetCrowdSimulationState()

Public function Const

int32

 

GetGroupsToAvoid()

Public function Const

int32

 

GetGroupsToIgnore()

Protected function Const

bool

 

HasMovedDuringPause()

Public function Const

bool

 

IsCrowdAffectFallingVelocityEnabled()

Public function Const

bool

 

IsCrowdAnticipateTurnsActive()

Checks if bEnableAnticipateTurns is set to true, and if crowd simulation is not suspended

Public function Const

bool

 

IsCrowdAnticipateTurnsEnabled()

Public function Const

bool

 

IsCrowdObstacleAvoidanceActive()

Checks if bEnableObstacleAvoidance is set to true, and if crowd simulation is not suspended

Public function Const

bool

 

IsCrowdObstacleAvoidanceEnabled()

Public function Const

bool

 

IsCrowdOptimizeTopologyActive()

Checks if bEnableOptimizeTopology is set to true, and if crowd simulation is not suspended

Public function Const

bool

 

IsCrowdOptimizeTopologyEnabled()

Public function Const

bool

 

IsCrowdOptimizeVisibilityEnabled()

Public function Const

bool

 

IsCrowdPathOffsetEnabled()

Public function Const

bool

 

IsCrowdRotateToVelocityEnabled()

Public function Const

bool

 

IsCrowdSeparationActive()

Checks if bEnableSeparation is set to true, and if crowd simulation is not suspended

Public function Const

bool

 

IsCrowdSeparationEnabled()

Public function Const

bool

 

IsCrowdSimulationActive()

Public function Const

bool

 

IsCrowdSimulationEnabled()

Public function Const

bool

 

IsCrowdSimulatioSuspended()

Public function Const

bool

 

IsCrowdSlowdownAtGoalEnabled()

Public function Virtual

void

 

OnNavNodeChanged

(
    NavNodeRef NewPolyRef,
    NavNodeRef PrevPolyRef,
    int32 CorridorSize
)

Called when agent moved to next nav node (poly)

Protected function

void

 

RegisterCrowdAgent()

Public function

void

 

SetAvoidanceGroup

(
    int32 GroupFlags,
    bool bUpdateAgent
)

Public function

void

 

SetCrowdAffectFallingVelocity

(
    bool bEnable
)

Public function

void

 

SetCrowdAnticipateTurns

(
    bool bEnable,
    bool bUpdateAgent
)

Public function

void

 

SetCrowdAvoidanceQuality

(
    ECrowdAvoidanceQuality::Type Qualit...,
    bool bUpdateAgent
)

Public function

void

 

SetCrowdAvoidanceRangeMultiplier

(
    float Multiplier,
    bool bUpdateAgent
)

Public function

void

 

SetCrowdCollisionQueryRange

(
    float Range,
    bool bUpdateAgent
)

Public function

void

 

SetCrowdObstacleAvoidance

(
    bool bEnable,
    bool bUpdateAgent
)

Public function

void

 

SetCrowdOptimizeTopology

(
    bool bEnable,
    bool bUpdateAgent
)

Public function

void

 

SetCrowdOptimizeVisibility

(
    bool bEnable,
    bool bUpdateAgent
)

Public function

void

 

SetCrowdPathOffset

(
    bool bEnable,
    bool bUpdateAgent
)

Public function

void

 

SetCrowdPathOptimizationRange

(
    float Range,
    bool bUpdateAgent
)

Public function

void

 

SetCrowdRotateToVelocity

(
    bool bEnable
)

Public function

void

 

SetCrowdSeparation

(
    bool bEnable,
    bool bUpdateAgent
)

Public function

void

 

SetCrowdSeparationWeight

(
    float Weight,
    bool bUpdateAgent
)

Public function Virtual

void

 

SetCrowdSimulationState

(
    ECrowdSimulationState NewState
)

Switch between crowd simulation and parent implementation (following path segments)

Public function

void

 

SetCrowdSlowdownAtGoal

(
    bool bEnable,
    bool bUpdateAgent
)

Public function

void

 

SetGroupsToAvoid

(
    int32 GroupFlags,
    bool bUpdateAgent
)

Public function

void

 

SetGroupsToIgnore

(
    int32 GroupFlags,
    bool bUpdateAgent
)

Protected function Const

bool

 

ShouldSwitchPathPart

(
    int32 CorridorSize
)

Protected function Virtual Const

bool

 

ShouldTrackMovingGoal

(
    FVector& OutGoalLocation
)

Public function Virtual

void

 

SuspendCrowdSteering

(
    bool bSuspend
)

Master switch for crowd steering & avoidance

Protected function

void

 

SwitchToNextPathPart()

Protected function

void

 

UpdateCachedDirections

(
    const FVector& NewVelocity,
    const FVector& NextPathCorner,
    bool bTraversingLink
)

Public function Const

void

 

UpdateCrowdAgentParams()

Update params in crowd manager

Public function

void

 

UpdateDestinationForMovingGoal

(
    const FVector& NewDestination
)

Overridden from UPathFollowingComponent

Name Description

Public function Virtual

void

 

AbortMove

(
    const UObject& Instigator,
    FPathFollowingResultFlags::Type Abo...,
    FAIRequestID RequestID,
    EPathFollowingVelocityMode Velocity...
)

Aborts following path

Public function Virtual

void

 

Cleanup()

Cleanup component before destroying

Public function Virtual Const

void

 

DescribeSelfToVisLog

(
    FVisualLogEntry* Snapshot
)

Protected function Virtual Const

int32

 

DetermineStartingPathPoint

(
    const FNavigationPath* Conside...
)

PathFollowingComponent BEGIN.

Public function Virtual

void

 

FinishUsingCustomLink

(
    INavLinkCustomInterface* Custo...
)

Call when moving agent finishes using custom nav link, returns control back to path following

Protected function Virtual

void

 

FollowPathSegment

(
    float DeltaTime
)

Follow current path segment

Public function Virtual Const

int32

 

GetCurrentPathElement()

Returns index of the currently followed element of path.

Public function Virtual Const

void

 

GetDebugStringTokens

(
    TArray< FString >& Tokens,
    TArray< EPathFollowingDebugTokens::...
)

Public function Virtual Const

FVector

 

GetMoveFocus

(
    bool bAllowStrafe
)

Get current focal point of movement

Public function Virtual

void

 

Initialize()

PathFollowingComponent BEGIN.

Protected function Virtual Const

bool

 

IsOnPath()

Check if agent is on path

Public function Virtual

void

 

OnNavigationInitDone()

Called when NavigationSystem finishes initial navigation data registration.

Public function Virtual

void

 

OnPathfindingQuery

(
    FPathFindingQuery& Query
)

Called when owner is preparing new pathfinding request

Public function Virtual

void

 

OnPathFinished

(
    const FPathFollowingResult& Result
)

Notify about finished movement

Public function Virtual

void

 

OnPathUpdated()

Notify about changing current path: new pointer or update from path event

Public function Virtual

void

 

PauseMove

(
    FAIRequestID RequestID,
    EPathFollowingVelocityMode Velocity...
)

Pause path following

Protected function Virtual

void

 

Reset()

Reset path following data

Public function Virtual

void

 

ResumeMove

(
    FAIRequestID RequestID
)

Resume path following

Protected function Virtual

void

 

SetMoveSegment

(
    int32 SegmentStartIndex
)

Sets variables related to current move segment

Protected function Virtual Const

bool

 

ShouldCheckPathOnResume()

Should verify if agent if still on path ater movement has been resumed?

Protected function Virtual

bool

 

UpdateMovementComponent

(
    bool bForce
)

Check if movement component is valid or tries to grab one from owner

Protected function Virtual

void

 

UpdatePathSegment()

Check state of path following, update move segment if needed

Overridden from UObject

Name Description

Public function Virtual

void

 

BeginDestroy()

Called before destroying the object.

Overridden from IPathFollowingAgentInterface

Name Description

Public function Virtual

void

 

OnLanded()

Called when falling movement ends.

Overridden from ICrowdAgentInterface

Name Description

Public function Virtual Const

int32

 

GetCrowdAgentAvoidanceGroup()

Group mask for this agent

Public function Virtual Const

void

 

GetCrowdAgentCollisions

(
    float& CylinderRadius,
    float& CylinderHalfHeight
)

Fills information about agent's collision cylinder

Public function Virtual Const

int32

 

GetCrowdAgentGroupsToAvoid()

Will avoid other agents if they are in one of specified groups

Public function Virtual Const

int32

 

GetCrowdAgentGroupsToIgnore()

Will NOT avoid other agents if they are in one of specified groups, higher priority than GroupsToAvoid

Public function Virtual Const

FVector

 

GetCrowdAgentLocation()

Public function Virtual Const

float

 

GetCrowdAgentMaxSpeed()

Public function Virtual Const

FVector

 

GetCrowdAgentVelocity()

Deprecated Variables

Name Description

Protected variable

FNavAvoidanceMa...

 

AvoidanceGroup_DEPRECATED

DEPRECATED: Group mask for this agent - use property from CharacterMovementComponent instead

Protected variable

uint8: 1

 

bEnableCrowdSimulation

Please use IsCrowdSimulationEnabled(), SetCrowdSimulationState() and SimulationState member for initialization.

Protected variable

FNavAvoidanceMa...

 

GroupsToAvoid_DEPRECATED

DEPRECATED: Will avoid other agents if they are in one of specified groups - use property from CharacterMovementComponent instead

Protected variable

FNavAvoidanceMa...

 

GroupsToIgnore_DEPRECATED

DEPRECATED: Will NOT avoid other agents if they are in one of specified groups, higher priority than GroupsToAvoid - use property from CharacterMovementComponent instead

Deprecated Functions

Name Description

Public function Virtual

void

 

SetCrowdSimulation

(
    bool bEnable
)

Use SetCrowdSimulationState function instead.

Protected function Virtual

bool

 

UpdateCachedGoal

(
    FVector& NewGoalPos
)

This function is now deprecated and was renamed to ShouldTrackMovingGoal.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss