Language:
Discover
By Skill Level
By Category

UPathFollowingComponent

Choose your OS:

Inheritance Hierarchy

Syntax

class UPathFollowingComponent :
    public UActorComponent ,
    public IAIResourceInterface ,
    public IPathFollowingAgentInterface

Variables

Name Description

Protected variable

float

 

AcceptanceRadius

Min distance to destination to consider request successful.

Protected variable

uint8 : 1

 

bCollidedWithGoal

Set when agent collides with goal actor

Protected variable

uint8 : 1

 

bIsDecelerating

True if pathfollowing is doing deceleration at the end of the path.

Protected variable

uint8 : 1

 

bIsUsingMetaPath

If set, path following is using FMetaNavMeshPath

Protected variable

uint8 : 1

 

bLastMoveReachedGoal

Set when last move request was finished at goal

Protected variable

float

 

BlockDetectionDistance

Detect blocked movement when distance between center of location samples and furthest one (centroid radius) is below threshold

Protected variable

float

 

BlockDetectionInterval

Interval for collecting location samples

Protected variable

int32

 

BlockDetectionSampleCount

Number of samples required for block detection

Protected variable

uint8 : 1

 

bMoveToGoalOnLastSegment

If set, target location will be constantly updated to match goal actor while following last segment of full path

Protected variable

uint8 : 1

 

bReachTestIncludesAgentRadius

Increase acceptance radius with agent's radius

Protected variable

uint8 : 1

 

bReachTestIncludesGoalRadius

Increase acceptance radius with goal's radius

Protected variable

uint8 : 1

 

bStopMovementOnFinish

If set, movement will be stopped on finishing path

Protected variable

uint8 : 1

 

bUseBlockDetection

If set, movement block detection will be used

Protected variable

uint8 : 1

 

bWalkingNavLinkStart

Gets set when agent starts following a navigation link.

Protected variable

float

 

CachedBrakingDistance

Braking distance for acceleration driven path following

Protected variable

float

 

CachedBrakingMaxSpeed

Max speed used for CachedBrakingDistance

Protected variable

float

 

CurrentAcceptanceRadius

Min distance to end of current path segment to consider segment finished

Protected variable

FWeakObjectPtr

 

CurrentCustomLinkOb

Currently traversed custom nav link

Protected variable

FBasedPosition

 

CurrentDestination

Destination for current path segment

Protected variable

FVector

 

CurrentMoveInput

Last MoveInput calculated and passed over to MovementComponent.

Protected variable

int32

 

DecelerationSegmentIndex

Index of path point for starting deceleration

Protected variable

TWeakObjectPtr <...

 

DestinationActor

Destination actor. Use SetDestinationActor to set this

Protected variable

const INavAgent ...

 

DestinationAgent

Cached DestinationActor cast to INavAgentInterface .

Protected variable

FCustomMoveShar ...

 

GameData

Game specific data

Protected variable

float

 

LastSampleTime

Timestamp of last location sample

Protected variable

TArray < FBasedP ...

 

LocationSamples

Location samples for stuck detection

Protected variable

FVector

 

LocationWhenPaused

Agent location when movement was paused

Protected variable

float

 

MinAgentHalfHeightPct

Part of agent height used as min acceptable height difference

Protected variable

float

 

MinAgentRadiusPct

Part of agent radius used as min acceptance radius

Protected variable

UNavMovementCom ...

 

MovementComp

Associated movement component

Protected variable

FVector

 

MoveOffset

Relative offset from goal actor's location to end of path

Protected variable

FVector

 

MoveSegmentDirection

Direction of current move segment

Protected variable

int32

 

MoveSegmentEndIndex

Index of path point being current move target

Protected variable

NavNodeRef

 

MoveSegmentEndRef

Reference of node at segment end

Protected variable

int32

 

MoveSegmentStartIndex

Index of path point being current move beginning

Protected variable

NavNodeRef

 

MoveSegmentStartRef

Reference of node at segment start

Protected variable

float

 

MyDefaultAcceptanceRadius

Value based on navigation agent's properties that's used for AcceptanceRadius when DefaultAcceptanceRadius is requested

Protected variable

ANavigationData ...

 

MyNavData

Navigation data for agent described in movement component

Protected variable

int32

 

NextSampleIdx

Index of next location sample in array

Public variable

FMoveComplete

 

OnRequestFinished

Delegate for move completion notify

Protected variable

FVector

 

OriginalMoveRequestGoalLocation

This is needed for partial paths when trying to figure out if following a path should finish before reaching path end, due to reaching requested acceptance radius away from original move goal Is being set for non-partial paths as well

Protected variable

FNavPathSharedP ...

 

Path

Requested path

Protected variable

float

 

PathTimeWhenPaused

Timestamp of path update when movement was paused

Public variable

FPostProcessMov ...

 

PostProcessMove

Delegate for modifying path following velocity

Protected variable

int32

 

PreciseAcceptanceRadiusCheckStartNodeIndex

Indicates a path node index at which precise "is at goal" tests are going to be performed every frame, in regards to acceptance radius

Protected variable

FAIResourceLock

 

ResourceLock

Used to keep track of which subsystem requested this AI resource be locked

Protected variable

TEnumAsByte < EP ...

 

Status

Current status

Protected variable

FTimerHandle

 

WaitingForPathTimer

Timer handle for OnWaitingPathTimeout function

Protected variable

float

 

WaitingTimeout

Timeout for Waiting state, negative value = infinite

Constructors

Name Description

Public function

UPathFollowingComponent

(
    const FObjectInitializer & ObjectIn...
)

Functions

Name Description

Public function Virtual

void

 

AbortMove

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

Aborts following path

Public function Virtual

void

 

AbortMove

(
    const FString & Reason,
    FAIRequestID RequestID,
    bool bResetVelocity,
    bool bSilent,
    uint8 MessageFlags
)

Public function Virtual

void

 

Cleanup()

Cleanup component before destroying

Protected function

void

 

DebugReachTest

(
    float& CurrentDot,
    float& CurrentDistance,
    float& CurrentHeight,
    uint8 & bDotFailed,
    uint8 & bDistanceFailed,
    uint8 & bHeightFailed
)

Debug point reach test values

Public function Virtual

void

 

DescribeSelfToVisLog

(
    FVisualLogEntry * Snapshot
)

Protected function Virtual

int32

 

DetermineCurrentTargetPathPoint

(
    int32 StartIndex
)

Index of path point, that should be target of current move segment

Protected function Virtual

int32

 

DetermineStartingPathPoint

(
    const FNavigationPath * Conside...
)

Checks if this PathFollowingComponent is already on path, and if so determines index of next path point

Public function

bool

 

DidMoveReachGoal()

Public function Virtual

void

 

DisplayDebug

(
    UCanvas * Canvas,
    const FDebugDisplayInfo & DebugDisp...,
    float& YL,
    float& YPos
)

Protected function

int32

 

FindPreciseAcceptanceRadiusTestsStartNodeIndex

(
    const FNavigationPath & PathInstanc...,
    const FVector & GoalLocation
)

For given path finds a path node at which PathfollowingComponent should start doing precise is-goal-in-acceptance-radius tests

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

Protected function

void

 

ForceBlockDetectionUpdate()

Force creating new location sample for block detection

Public function

float

 

GetAcceptanceRadius()

Public function

UObject *...

 

GetCurrentCustomLinkOb()

Public function

FVector

 

GetCurrentDirection()

Public function

FVector

 

GetCurrentMoveInput()

Note that CurrentMoveInput is only valid if MovementComp->UseAccelerationForPathFollowing() == true

Public function

FNavLocation

 

GetCurrentNavLocation()

Returns current location on navigation data

Public function Virtual

int32

 

GetCurrentPathElement()

Returns index of the currently followed element of path.

Public function

uint32

 

GetCurrentPathIndex()

Public function

FAIRequestID

 

GetCurrentRequestId()

Public function

FVector

 

GetCurrentTargetLocation()

Public function

FBasedPositi ...

 

GetCurrentTargetLocationBased()

Public function Virtual

FString

 

GetDebugString()

Public function Virtual

void

 

GetDebugStringTokens

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

ENABLE_VISUAL_LOG.

Public function

float

 

GetDefaultAcceptanceRadius()

Protected function

float

 

GetFinalAcceptanceRadius

(
    const FNavigationPath & PathInstanc...,
    const FVector OriginalGoalLocation,
    const FVector * PathEndOverride
)

Based on Path's properties, original move goal location and requested AcceptanceRadius this function calculates actual acceptance radius to apply when testing if the agent has successfully reached requested goal's vicinity

Public function Virtual

FVector

 

GetMoveFocus

(
    bool bAllowStrafe
)

Get current focal point of movement

Public function

AActor *

 

GetMoveGoal()

Public function

FVector

 

GetMoveGoalLocationOffset()

Public function

uint32

 

GetNextPathIndex()

Protected function Static

uint32

 

GetNextRequestId()

Public function

const FNavPa ...

 

GetPath()

Public function

EPathFollowi ...

 

GetPathActionType()

Public function

FVector

 

GetPathDestination()

Public function

float

 

GetRemainingPathCost()

Estimated cost of unprocessed path segments 0 means, that component is following final path segment or doesn't move

Public function

FString

 

GetResultDesc

(
    EPathFollowingResult::Type Result
)

Readable name of result enum

Public function

EPathFollowi ...

 

GetStatus()

Public function

FString

 

GetStatusDesc()

Readable name of current status

Protected function Virtual

bool

 

HandlePathUpdateEvent()

Called after receiving update event from current path

Public function

bool

 

HasDirectPath()

Public function

bool

 

HasMovementAuthority()

Check if path following has authority over movement (e.g. not falling) and can update own state

Public function

bool

 

HasPartialPath()

Public function

bool

 

HasReached

(
    const FVector & TestPoint,
    float AcceptanceRadius,
    bool bExactSpot
)

Public function

bool

 

HasReached

(
    const FVector & TestPoint,
    EPathFollowingReachMode ReachMode,
    float AcceptanceRadius
)

Simple test for stationary agent (used as early finish condition), check if reached given point

Public function

bool

 

HasReached

(
    const FAIMoveRequest & MoveRequest
)

Simple test for stationary agent (used as early finish condition), check if reached target specified in move request

Public function

bool

 

HasReached

(
    const AActor & TestGoal,
    float AcceptanceRadius,
    bool bExactSpot,
    bool bUseNavAgentGoalLocation
)

Public function

bool

 

HasReached

(
    const AActor & TestGoal,
    EPathFollowingReachMode ReachMode,
    float AcceptanceRadius,
    bool bUseNavAgentGoalLocation
)

Simple test for stationary agent (used as early finish condition), check if reached given goal

Protected function Virtual

bool

 

HasReachedCurrentTarget

(
    const FVector & CurrentLocation
)

Check if segment is completed

Protected function

bool

 

HasReachedDestination

(
    const FVector & CurrentLocation
)

Check if move is completed

Protected function

bool

 

HasReachedInternal

(
    const FVector & GoalLocation,
    float GoalRadius,
    float GoalHalfHeight,
    const FVector & AgentLocation,
    float RadiusThreshold,
    float AgentRadiusMultiplier
)

Check if moving agent has reached goal defined by cylinder

Public function

bool

 

HasStartedNavLinkMove()

Public function

bool

 

HasValidPath()

Public function Virtual

void

 

Initialize()

Initialize component to use

Public function

bool

 

IsBlockDetectionActive()

State of block detection

Protected function

bool

 

IsBlocked()

Check if movement is blocked

Public function

bool

 

IsCurrentSegmentNavigationLink()

Public function

bool

 

IsDecelerating()

Returns true if pathfollowing is doing deceleration at the end of the path.

Protected function Virtual

bool

 

IsOnPath()

Check if agent is on path

Public function Virtual

bool

 

IsPathFollowingAllowed()

IPathFollowingAgentInterface end.

Public function

bool

 

IsStopMovementOnFinishActive()

State of movement stopping on finish

Public function Static

void

 

LogPathHelper

(
    const AActor * LogOwner,
    FNavPathSharedPtr InLogPath,
    const AActor * LogGoalActor
)

Helper function for sending a path for visual log

Public function Static

void

 

LogPathHelper

(
    const AActor * LogOwner,
    FNavigationPath * InLogPath,
    const AActor * LogGoalActor
)

Public function Virtual

void

 

OnActorBump

(
    AActor * SelfActor,
    AActor * OtherActor,
    FVector NormalImpulse,
    const FHitResult & Hit
)

ENABLE_VISUAL_LOG.

Protected function

void

 

OnNavDataRegistered

(
    ANavigationData * NavData
)

Called when NavigationSystem registers new navigation data type while this component instance has empty MyNavData.

Protected function Virtual

void

 

OnNavigationInitDone()

Called when NavigationSystem finishes initial navigation data registration.

Protected function Virtual

void

 

OnNewPawn

(
    APawn * NewPawn
)

Called if owning Controller possesses new pawn or ends up pawn-less.

Public function

void

 

OnPathEvent

(
    FNavigationPath * InPath,
    ENavPathEvent::Type Event
)

IAIResourceInterface end.

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

 

OnPathFinished

(
    EPathFollowingResult::Type Result
)

Public function

void

 

OnPathFinished

(
    EPathFollowingResult::Type ResultCo...,
    uint16 ExtraResultFlags
)

Public function Virtual

void

 

OnPathUpdated()

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

Public function Virtual

void

 

OnSegmentFinished()

Notify about finishing move along current path segment

Protected function Virtual

void

 

OnWaitingPathTimeout()

Called from timer if component spends too much time in Waiting state

Public function

int32

 

OptimizeSegmentVisibility

(
    int32 StartIndex
)

Public function Virtual

void

 

PauseMove

(
    FAIRequestID RequestID,
    EPathFollowingVelocityMode Velocity...
)

Pause path following

Public function Virtual

void

 

PauseMove

(
    FAIRequestID RequestID,
    bool bResetVelocity
)

Public function Virtual

FAIRequestID

 

RequestMove

(
    const FAIMoveRequest & RequestData,
    FNavPathSharedPtr InPath
)

Start movement along path

MoveId of requested move

Public function

FAIRequestID

 

RequestMove

(
    FNavPathSharedPtr InPath,
    const AActor * InDestinationAct...,
    float InAcceptanceRadius,
    bool InStopOnOverlap,
    FCustomMoveSharedPtr InGameData
)

Public function Virtual

FAIRequestID

 

RequestMove

(
    FNavPathSharedPtr Path,
    FRequestCompletedSignature OnComple...,
    const AActor * DestinationActor,
    float AcceptanceRadius,
    bool bStopOnOverlap,
    FCustomMoveSharedPtr GameData
)

Deprecated functions

Public function

FAIRequestID

 

RequestMoveWithImmediateFinish

(
    EPathFollowingResult::Type Result,
    EPathFollowingVelocityMode Velocity...
)

Create new request and finish it immediately (e.g. already at goal)

Protected function Virtual

void

 

Reset()

Reset path following data

Protected function

void

 

ResetBlockDetectionData()

Clears Block Detection stored data effectively resetting the mechanism

Public function Virtual

void

 

ResumeMove

(
    FAIRequestID RequestID
)

Resume path following

Public function

void

 

SetAcceptanceRadius

(
    const float InAcceptanceRadius
)

Public function

void

 

SetBlockDetection

(
    float DistanceThreshold,
    float Interval,
    int32 NumSamples
)

Set block detection params

Public function

void

 

SetBlockDetectionState

(
    bool bEnable
)

Update state of block detection

Public function

void

 

SetDestinationActor

(
    const AActor * InDestinationAct...
)

Public function

void

 

SetLastMoveAtGoal

(
    bool bFinishedAtGoal
)

Set status of last requested move, works only in Idle state

Public function Virtual

void

 

SetMovementComponent

(
    UNavMovementComponent * MoveCom...
)

Set associated movement component

Protected function Virtual

void

 

SetMoveSegment

(
    int32 SegmentStartIndex
)

Sets variables related to current move segment

Protected function

void

 

SetNextMoveSegment()

Switch to next segment on path

Public function

void

 

SetPreciseReachThreshold

(
    float AgentRadiusMultiplier,
    float AgentHalfHeightMultiplier
)

Set threshold for precise reach tests in intermediate goals (minimal test radius)

Public function

void

 

SetStopMovementOnFinish

(
    bool bEnable
)

Set whether movement is stopped on finish of move.

Protected function Virtual

bool

 

ShouldCheckPathOnResume()

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

Protected function Virtual

void

 

StartUsingCustomLink

(
    INavLinkCustomInterface * Custo...,
    const FVector & DestPoint
)

Next path segment if custom nav link, try passing control to it

Protected function

void

 

StoreRequestId()

Assign new request Id

Protected function Virtual

bool

 

UpdateBlockDetection()

Update blocked movement detection,

true if new sample was added

Public function Virtual

void

 

UpdateCachedComponents()

Updates cached pointers to relevant owner's components

Protected function Virtual

void

 

UpdateDecelerationData()

Updates braking distance and deceleration segment

Public function Virtual

bool

 

UpdateMove

(
    FNavPathSharedPtr Path,
    FAIRequestID RequestID
)

Protected function

void

 

UpdateMoveFocus()

Set move focus in AI owner

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 UActorComponent

Name Description

Public function Virtual

void

 

OnRegister()

WITH_EDITOR.

Public function Virtual

void

 

TickComponent

(
    float DeltaTime,
    enum ELevelTick TickType,
    FActorComponentTickFunction * T...
)

Function called every frame on this ActorComponent.

Overridden from IAIResourceInterface

Name Description

Public function Virtual

void

 

ClearResourceLock

(
    EAIRequestPriority::Type LockSource
)

Clear resource lock of the given origin

Public function Virtual

void

 

ForceUnlockResource()

Force-clears all locks on resource

Public function Virtual

bool

 

IsResourceLocked()

Check whether resource is currently locked

Public function Virtual

void

 

LockResource

(
    EAIRequestPriority::Type LockSource
)

IAIResourceInterface begin.

Overridden from IPathFollowingAgentInterface

Name Description

Public function Virtual

void

 

OnLanded()

Called when falling movement ends.

Public function Virtual

void

 

OnStartedFalling()

Virtual void OnMoveBlockedBy(const FHitResult& BlockingImpact) {}

Public function Virtual

void

 

OnUnableToMove

(
    const UObject & Instigator
)

IPathFollowingAgentInterface begin.

Typedefs

Constants

Name

Description

DefaultAcceptanceRadius

Special float constant to symbolize "use default value".

NextRequestId

Used for debugging purposes to be able to identify which logged information results from which request, if there was multiple ones during one frame

References

Module

AIModule

Header

Runtime/AIModule/Classes/Navigation/PathFollowingComponent.h