UNavLinkCustomComponent

Encapsulates NavLinkCustomInterface interface, can be used with Actors not relevant for navigation

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

NavigationSystem

Header

/Engine/Source/Runtime/NavigationSystem/Public/NavLinkCustomComponent.h

Include

#include "NavLinkCustomComponent.h"

Syntax

class UNavLinkCustomComponent :
    public UNavRelevantComponent,
    public INavLinkCustomInterface

Remarks

Encapsulates NavLinkCustomInterface interface, can be used with Actors not relevant for navigation

Additional functionality:

  • can be toggled

  • can create obstacle area for easier/forced separation of link end points

  • can broadcast state changes to nearby agents

Variables

Name Description

Protected variable

uint32: 1

 

bCreateBoxObstacle

If set, box obstacle area will be added to generation

Protected variable

uint32: 1

 

bLinkEnabled

Is link currently in enabled state? (area class)

Protected variable

uint32: 1

 

bNotifyWhenDisabled

Should link notify nearby agents when it changes state to disabled

Protected variable

uint32: 1

 

bNotifyWhenEnabled

Should link notify nearby agents when it changes state to enabled

Protected variable

TEnumAsByte< EC...

 

BroadcastChannel

Trace channel for state change broadcast

Protected variable

float

 

BroadcastInterval

Interval for state change broadcast (0 = single broadcast)

Protected variable

float

 

BroadcastRadius

Radius of state change broadcast

Protected variable

TSubclassOf< UN...

 

DisabledAreaClass

Area class to use when link is disabled

Protected variable

TSubclassOf< UN...

 

EnabledAreaClass

Area class to use when link is enabled

Protected variable

TEnumAsByte< EN...

 

LinkDirection

Direction of link

Protected variable

FVector

 

LinkRelativeEnd

End point, relative to owner

Protected variable

FVector

 

LinkRelativeStart

Start point, relative to owner

Protected variable

TArray< TWeakOb...

 

MovingAgents

List of agents moving though this link

Protected variable

uint32

 

NavLinkUserId

Link Id assigned by navigation system

Protected variable

TSubclassOf< UN...

 

ObstacleAreaClass

Area class for simple box obstacle

Protected variable

FVector

 

ObstacleExtent

Extent of simple box obstacle

Protected variable

FVector

 

ObstacleOffset

Offset of simple box obstacle

Protected variable

FBroadcastFilte...

 

OnBroadcastFilter

Delegate to call when link is reached

Protected variable

FOnMoveReachedL...

 

OnMoveReachedLink

Delegate to call when link is reached

Protected variable

FNavAgentSelect...

 

SupportedAgents

Restrict area only to specified agents

Protected variable

FTimerHandle

 

TimerHandle_BroadcastStateChange

Handle for efficient management of BroadcastStateChange timer

Constructors

Name Description

Public function

UNavLinkCustomComponent

(
    const FObjectInitializer& ObjectIn...
)

Functions

Name Description

Public function

void

 

AddNavigationObstacle

(
    TSubclassOf< UNavArea > AreaClass,
    const FVector& BoxExtent,
    const FVector& BoxOffset
)

Add box obstacle during generation of navigation data this can be used to create empty area under doors

Public function

void

 

ApplyComponentInstanceData

(
    FNavLinkCustomInstanceData* Co...
)

Protected function

void

 

BroadcastStateChange()

Notify nearby agents about link changing state

Public function

void

 

ClearNavigationObstacle()

Removes simple obstacle

Protected function

void

 

CollectNearbyAgents

(
    TArray< UObject* >& NotifyLis...
)

Gather agents to notify about state change

Public function Const

TSubclassOf<...

 

GetDisabledArea()

Public function Const

TSubclassOf<...

 

GetEnabledArea()

Public function Const

FVector

 

GetEndPoint()

Get link end point in world space

Public function Virtual Const

FNavigationL...

 

GetLinkModifier()

Public function Const

FVector

 

GetStartPoint()

Get link start point in world space

Public function Const

FNavAgentSel...

 

GetSupportedAgents()

Public function Const

bool

 

HasMovingAgents()

Check is any agent is currently moving though this link

Public function Const

bool

 

IsEnabled()

Public function

void

 

SendBroadcastWhenDisabled

(
    bool bEnabled
)

Public function

void

 

SendBroadcastWhenEnabled

(
    bool bEnabled
)

Public function

void

 

SetBroadcastData

(
    float Radius,
    ECollisionChannel TraceChannel,
    float Interval
)

Set properties of trigger around link entry point(s), that will notify nearby agents about link state change

Public function

void

 

SetBroadcastFilter

(
    UserClass* TargetOb,
    typename FBroadcastFilter::TConstMe...
)

Public function

void

 

SetBroadcastFilter

(
    UserClass* TargetOb,
    typename FBroadcastFilter::TMethodP...
)

Public function

void

 

SetBroadcastFilter

(
    FBroadcastFilter const& InDelegate
)

Set delegate to filter

Public function

void

 

SetDisabledArea

(
    TSubclassOf< UNavArea > AreaClass
)

Set area class to use when link is disabled

Public function

void

 

SetEnabled

(
    bool bNewEnabled
)

Change state of smart link (used area class)

Public function

void

 

SetEnabledArea

(
    TSubclassOf< UNavArea > AreaClass
)

Set area class to use when link is enabled

Public function

void

 

SetLinkData

(
    const FVector& RelativeStart,
    const FVector& RelativeEnd,
    ENavLinkDirection::Type Direction
)

Set basic link data: end points and direction

Public function

void

 

SetMoveReachedLink

(
    FOnMoveReachedLink const& InDelega...
)

Set delegate to notify about reaching this link during path following

Public function

void

 

SetMoveReachedLink

(
    UserClass* TargetOb,
    typename FOnMoveReachedLink::TConst...
)

Public function

void

 

SetMoveReachedLink

(
    UserClass* TargetOb,
    typename FOnMoveReachedLink::TMetho...
)

Public function

void

 

SetSupportedAgents

(
    const FNavAgentSelector& InSupport...
)

Overridden from UNavRelevantComponent

Name Description

Public function Virtual Const

void

 

CalcAndCacheBounds()

Overridden from UActorComponent

Name Description

Public function Virtual Const

TStructOnSco...

 

GetComponentInstanceData()

Called before we throw away components during RerunConstructionScripts, to cache any data we wish to persist across that operation

Public function Virtual

void

 

OnRegister()

Called when a component is registered, after Scene is set, but before CreateRenderState_Concurrent or OnCreatePhysicsState are called.

Public function Virtual

void

 

OnUnregister()

Called when a component is unregistered.

Overridden from UObject

Name Description

Public function Virtual

void

 

PostEditImport()

Called after importing property values for this object (paste, duplicate or .t3d import) Allow the object to perform any cleanup for properties which shouldn't be duplicated or are unsupported by the script serialization

Public function Virtual

void

 

PostLoad()

Do any object-specific cleanup required immediately after loading an object.

Overridden from INavRelevantInterface

Name Description

Public function Virtual Const

void

 

GetNavigationData

(
    FNavigationRelevantData& Data
)

Prepare navigation modifiers

Overridden from INavLinkCustomInterface

Name Description

Public function Virtual Const

TSubclassOf<...

 

GetLinkAreaClass()

Get basic link data: area class (null = default walkable)

Public function Virtual Const

void

 

GetLinkData

(
    FVector& LeftPt,
    FVector& RightPt,
    ENavLinkDirection::Type& Direction
)

Get basic link data: two points (relative to owner) and direction

Public function Virtual Const

uint32

 

GetLinkId()

Get unique ID number for custom link Owner should get its unique ID by calling INavLinkCustomInterface::GetUniqueId() and store it

Public function Virtual Const

void

 

GetSupportedAgents

(
    FNavAgentSelector& OutSupportedAge...
)

Get agents supported by this link

Public function Virtual Const

bool

 

IsLinkPathfindingAllowed

(
    const UObject* Querier
)

Check if link allows path finding Querier is usually an AIController trying to find path

Public function Virtual

void

 

OnLinkMoveFinished

(
    UObject* PathComp
)

Notify called when agent finishes using this link for movement

Public function Virtual

bool

 

OnLinkMoveStarted

(
    UObject* PathComp,
    const FVector& DestPoint
)

Notify called when agent starts using this link for movement.

Public function Virtual

void

 

UpdateLinkId

(
    uint32 NewUniqueId
)

Update unique ID number for custom link by navigation system

Typedefs