Navigation
API > API/Runtime > API/Runtime/AIModule > API/Runtime/AIModule/Navigation
Inheritance Hierarchy
- UObjectBase
- UObjectBaseUtility
- UObject
- UActorComponent
- UPathFollowingComponent
- UCrowdFollowingComponent
- UGridPathFollowingComponent
References
| Module | AIModule |
| Header | /Engine/Source/Runtime/AIModule/Classes/Navigation/PathFollowingComponent.h |
| Include | #include "Navigation/PathFollowingComponent.h" |
Syntax
class UPathFollowingComponent :
public UActorComponent,
public IAIResourceInterface,
public IPathFollowingAgentInterface
Variables
| Type | Name | Description | |
|---|---|---|---|
| float | AcceptanceRadius | Min distance to destination to consider request successful. | |
| uint8: 1 | bCollidedWithGoal | Set when agent collides with goal actor | |
| uint8: 1 | bIsDecelerating | True if pathfollowing is doing deceleration at the end of the path. | |
| uint8: 1 | bIsUsingMetaPath | If set, path following is using FMetaNavMeshPath | |
| uint8: 1 | bLastMoveReachedGoal | Set when last move request was finished at goal | |
| float | BlockDetectionDistance | Detect blocked movement when distance between center of location samples and furthest one (centroid radius) is below threshold | |
| float | BlockDetectionInterval | Interval for collecting location samples | |
| int32 | BlockDetectionSampleCount | Number of samples required for block detection | |
| uint8: 1 | bMoveToGoalOnLastSegment | If set, target location will be constantly updated to match goal actor while following last segment of full path | |
| uint8: 1 | bReachTestIncludesAgentRadius | Increase acceptance radius with agent's radius | |
| uint8: 1 | bReachTestIncludesGoalRadius | Increase acceptance radius with goal's radius | |
| uint8: 1 | bStopMovementOnFinish | If set, movement will be stopped on finishing path | |
| uint8: 1 | bUseBlockDetection | If set, movement block detection will be used | |
| uint8: 1 | bWalkingNavLinkStart | Gets set when agent starts following a navigation link. | |
| float | CachedBrakingDistance | Braking distance for acceleration driven path following | |
| float | CachedBrakingMaxSpeed | Max speed used for CachedBrakingDistance | |
| float | CurrentAcceptanceRadius | Min distance to end of current path segment to consider segment finished | |
| FWeakObjectPtr | CurrentCustomLinkOb | Currently traversed custom nav link | |
| FBasedPosition | CurrentDestination | Destination for current path segment | |
| FVector | CurrentMoveInput | Last MoveInput calculated and passed over to MovementComponent. | |
| uint8: 1 | DEBUG_bMovingDirectlyToGoal | ||
| int32 | DecelerationSegmentIndex | Index of path point for starting deceleration | |
| TWeakObjectPtr< AActor > | DestinationActor | Destination actor. Use SetDestinationActor to set this | |
| const INavAgentInterface * | DestinationAgent | Cached DestinationActor cast to INavAgentInterface. | |
| FCustomMoveSharedPtr | GameData | Game specific data | |
| double | LastSampleTime | Timestamp of last location sample | |
| TArray< FBasedPosition > | LocationSamples | Location samples for stuck detection | |
| FVector | LocationWhenPaused | Agent location when movement was paused | |
| float | MinAgentHalfHeightPct | Part of agent height used as min acceptable height difference | |
| float | MinAgentRadiusPct | Part of agent radius used as min acceptance radius | |
| TObjectPtr< UNavMovementComponent > | MovementComp | Associated movement component | |
| FVector | MoveOffset | Relative offset from goal actor's location to end of path | |
| FVector | MoveSegmentDirection | Direction of current move segment | |
| int32 | MoveSegmentEndIndex | Index of path point being current move target | |
| NavNodeRef | MoveSegmentEndRef | Reference of node at segment end | |
| int32 | MoveSegmentStartIndex | Index of path point being current move beginning | |
| NavNodeRef | MoveSegmentStartRef | Reference of node at segment start | |
| float | MyDefaultAcceptanceRadius | Value based on navigation agent's properties that's used for AcceptanceRadius when DefaultAcceptanceRadius is requested | |
| TObjectPtr< ANavigationData > | MyNavData | Navigation data for agent described in movement component | |
| int32 | NextSampleIdx | Index of next location sample in array | |
| FMoveComplete | OnRequestFinished | Delegate for move completion notify | |
| 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 | |
| FNavPathSharedPtr | Path | Requested path | |
| double | PathTimeWhenPaused | Timestamp of path update when movement was paused | |
| FPostProcessMoveSignature | PostProcessMove | Delegate for modifying path following velocity | |
| 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 | |
| FAIResourceLock | ResourceLock | Used to keep track of which subsystem requested this AI resource be locked | |
| TEnumAsByte< EPathFollowingStatus::Type > | Status | Current status | |
| FTimerHandle | WaitingForPathTimer | Timer handle for OnWaitingPathTimeout function | |
| float | WaitingTimeout | Timeout for Waiting state, negative value = infinite |
Constructors
| Type | Name | Description | |
|---|---|---|---|
UPathFollowingComponent
(
const FObjectInitializer& ObjectInitializer |
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | AbortMove
(
const UObject& Instigator, |
Aborts following path | |
| void | Cleanup () |
Cleanup component before destroying | |
| void | DebugReachTest
(
float& CurrentDot, |
Debug point reach test values | |
| void | DescribeSelfToVisLog
(
FVisualLogEntry* Snapshot |
||
| int32 | DetermineCurrentTargetPathPoint
(
int32 StartIndex |
||
| int32 | DetermineStartingPathPoint
(
const FNavigationPath* ConsideredPath |
Checks if this PathFollowingComponent is already on path, and if so determines index of next path point | |
| bool | |||
| void | DisplayDebug
(
UCanvas* Canvas, |
||
| int32 | FindPreciseAcceptanceRadiusTestsStartNodeIndex
(
const FNavigationPath& PathInstance, |
For given path finds a path node at which PathfollowingComponent should start doing precise is-goal-in-acceptance-radius tests | |
| void | FinishUsingCustomLink
(
INavLinkCustomInterface* CustomNavLink |
Call when moving agent finishes using custom nav link, returns control back to path following | |
| void | FollowPathSegment
(
float DeltaTime |
Follow current path segment | |
| void | Force creating new location sample for block detection | ||
| float | |||
| UObject * | |||
| FVector | |||
| FVector | Note that CurrentMoveInput is only valid if MovementComp->UseAccelerationForPathFollowing() == true | ||
| FNavLocation | Returns current location on navigation data | ||
| int32 | Returns index of the currently followed element of path. | ||
| uint32 | |||
| FAIRequestID | |||
| FVector | |||
| FBasedPosition | |||
| FString | |||
| void | GetDebugStringTokens
(
TArray< FString >& Tokens, |
||
| float | |||
| float | GetFinalAcceptanceRadius
(
const FNavigationPath& PathInstance, |
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 | |
| FVector | GetMoveFocus
(
bool bAllowStrafe |
Get current focal point of movement | |
| AActor * | GetMoveGoal () |
||
| FVector | |||
| uint32 | |||
| uint32 | |||
| const FNavPathSharedPtr | GetPath () |
||
| EPathFollowingAction::Type | |||
| FVector | |||
| FVector::FReal | |||
| FString | GetResultDesc
(
EPathFollowingResult::Type Result |
Readable name of result enum | |
| EPathFollowingStatus::Type | GetStatus () |
||
| FString | Readable name of current status | ||
| bool | Called after receiving update event from current path | ||
| bool | |||
| bool | Check if path following has authority over movement (e.g. not falling) and can update own state | ||
| bool | |||
| bool | HasReached
(
const AActor& TestGoal, |
Simple test for stationary agent (used as early finish condition), check if reached given goal | |
| bool | HasReached
(
const FVector& TestPoint, |
Simple test for stationary agent (used as early finish condition), check if reached given point | |
| bool | HasReached
(
const FAIMoveRequest& MoveRequest |
Simple test for stationary agent (used as early finish condition), check if reached target specified in move request | |
| bool | HasReachedCurrentTarget
(
const FVector& CurrentLocation |
Check if segment is completed | |
| bool | HasReachedDestination
(
const FVector& CurrentLocation |
Check if move is completed | |
| bool | HasReachedInternal
(
const FVector& GoalLocation, |
Check if moving agent has reached goal defined by cylinder | |
| bool | |||
| bool | HasValidPath () |
||
| void | Initialize () |
Initialize component to use | |
| bool | |||
| bool | IsBlocked () |
Check if movement is blocked | |
| bool | |||
| bool | Returns true if pathfollowing is doing deceleration at the end of the path. | ||
| bool | IsOnPath () |
Check if agent is on path | |
| bool | Check if path following can be activated | ||
| bool | |||
| void | LogPathHelper
(
const AActor* LogOwner, |
Helper function for sending a path for visual log | |
| void | LogPathHelper
(
const AActor* LogOwner, |
Helper function for sending a path for visual log | |
| void | OnActorBump
(
AActor* SelfActor, |
Called when moving agent collides with another actor | |
| void | OnNavDataRegistered
(
ANavigationData* NavData |
Called when NavigationSystem registers new navigation data type while this component instance has empty MyNavData. | |
| void | Called when NavigationSystem finishes initial navigation data registration. | ||
| void | Called if owning Controller possesses new pawn or ends up pawn-less. | ||
| void | OnPathEvent
(
FNavigationPath* InPath, |
Path observer | |
| void | OnPathfindingQuery
(
FPathFindingQuery& Query |
Called when owner is preparing new pathfinding request | |
| void | OnPathFinished
(
const FPathFollowingResult& Result |
Notify about finished movement | |
| void | OnPathFinished
(
EPathFollowingResult::Type ResultCode, |
||
| void | Notify about changing current path: new pointer or update from path event | ||
| void | Notify about finishing move along current path segment | ||
| void | Called from timer if component spends too much time in Waiting state | ||
| void | PauseMove
(
FAIRequestID RequestID, |
Pause path following | |
| FAIRequestID | RequestMove
(
const FAIMoveRequest& RequestData, |
Start movement along path | |
| FAIRequestID | RequestMoveWithImmediateFinish
(
EPathFollowingResult::Type Result, |
Create new request and finish it immediately (e.g. already at goal) | |
| void | Reset () |
Reset path following data | |
| void | Clears Block Detection stored data effectively resetting the mechanism | ||
| void | ResumeMove
(
FAIRequestID RequestID |
Resume path following | |
| void | SetAcceptanceRadius
(
const float InAcceptanceRadius |
||
| void | SetBlockDetection
(
float DistanceThreshold, |
Set block detection params | |
| void | SetBlockDetectionState
(
bool bEnable |
Update state of block detection | |
| void | SetDestinationActor
(
const AActor* InDestinationActor |
||
| void | SetLastMoveAtGoal
(
bool bFinishedAtGoal |
Set status of last requested move, works only in Idle state | |
| void | SetMovementComponent
(
UNavMovementComponent* MoveComp |
Set associated movement component | |
| void | SetMoveSegment
(
int32 SegmentStartIndex |
Sets variables related to current move segment | |
| void | Switch to next segment on path | ||
| void | SetPreciseReachThreshold
(
float AgentRadiusMultiplier, |
Set threshold for precise reach tests in intermediate goals (minimal test radius) | |
| void | SetStopMovementOnFinish
(
bool bEnable |
Set whether movement is stopped on finish of move. | |
| bool | Should verify if agent if still on path ater movement has been resumed? | ||
| bool | Defines if the agent should reset his velocity when the path is finished | ||
| void | StartUsingCustomLink
(
INavLinkCustomInterface* CustomNavLink, |
Next path segment if custom nav link, try passing control to it | |
| void | Assign new request Id | ||
| bool | Update blocked movement detection, | ||
| void | Updates cached pointers to relevant owner's components | ||
| void | Updates braking distance and deceleration segment | ||
| void | Set move focus in AI owner | ||
| bool | UpdateMovementComponent
(
bool bForce |
Check if movement component is valid or tries to grab one from owner | |
| void | Check state of path following, update move segment if needed |
Overridden from UActorComponent
| Type | Name | Description | |
|---|---|---|---|
| void | OnRegister () |
Called when a component is registered, after Scene is set, but before CreateRenderState_Concurrent or OnCreatePhysicsState are called. | |
| void | TickComponent
(
float DeltaTime, |
Function called every frame on this ActorComponent. |
Overridden from IAIResourceInterface
| Type | Name | Description | |
|---|---|---|---|
| void | ClearResourceLock
(
EAIRequestPriority::Type LockSource |
Clear resource lock of the given origin | |
| void | Force-clears all locks on resource | ||
| bool | Check whether resource is currently locked | ||
| void | LockResource
(
EAIRequestPriority::Type LockSource |
If resource is lockable lock it with indicated priority |
Overridden from IPathFollowingAgentInterface
| Type | Name | Description | |
|---|---|---|---|
| void | OnLanded () |
Called when falling movement ends. | |
| void | Virtual void OnMoveBlockedBy(const FHitResult& BlockingImpact) {} | ||
| void | OnUnableToMove
(
const UObject& Instigator |
Called when pathfollowing agent is not able to move anymore |
Typedefs
| Name | Description |
|---|---|
| FMoveComplete | |
| FMoveCompletedSignature | |
| FPostProcessMoveSignature | |
| FRequestCompletedSignature |
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 |
Deprecated Variables
| Type | Name | Description | |
|---|---|---|---|
| FMoveCompletedSignature | OnMoveFinished_DEPRECATED | This delegate is now deprecated, please use OnRequestFinished instead. |