Navigation
API > API/Runtime > API/Runtime/NavigationSystem
Inheritance Hierarchy
- UObjectBase
- UObjectBaseUtility
- UObject
- AActor
- ANavigationData
- AAbstractNavData
- ANavigationGraph
- ARecastNavMesh
References
| Module | NavigationSystem |
| Header | /Engine/Source/Runtime/NavigationSystem/Public/NavigationData.h |
| Include | #include "NavigationData.h" |
Syntax
class ANavigationData :
public AActor,
public INavigationDataInterface
Remarks
Represents abstract Navigation Data (sub-classed as NavMesh, NavGraph, etc) Used as a common interface for all navigation types handled by NavigationSystem
Variables
| Type | Name | Description | |
|---|---|---|---|
| TArray< FNavPathWeakPtr > | ActivePaths | Container for all path objects generated with this Navigation Data instance. | |
| FCriticalSection | ActivePathsLock | Synchronization object for paths registration from main thread and async pathfinding thread | |
| TMap< const UClass *, int32 > | AreaClassToIdMap | Mapping for SupportedAreas | |
| uint32: 1 | bAutoDestroyWhenNoNavigation | Should this instance auto-destroy when there's no navigation system on world when it gets created/loaded | |
| uint32: 1 | bCanBeMainNavData | If set, navigation data can act as default one in navigation system's queries | |
| uint32: 1 | bCanSpawnOnRebuild | If set, navigation data will be spawned in persistent level during rebuild if actor doesn't exist | |
| uint32: 1 | bEnableDrawing | If set to true then this navigation data will be drawing itself when requested as part of "show navigation" | |
| uint32: 1 | bForceRebuildOnLoad | Game-time config | |
| uint32: 1 | bIsBuildingOnLoad | ||
| uint32: 1 | bRebuildingSuspended | Set via SetRebuildingSuspended and controlling if RebuildDirtyAreas get passed over to the generator instantly or cached in SuspendedDirtyAreas to be applied at later date with SetRebuildingSuspended(false) call | |
| uint32: 1 | bRegistered | Whether this instance is registered with Navigation System | |
| uint32: 1 | bSupportsDefaultAgent | Was it generated for default agent (SupportedAgents[0]) | |
| uint32 | DataVersion | Navigation data versioning. | |
| FSharedNavQueryFilter | DefaultQueryFilter | Query filter used when no other has been passed to relevant functions | |
| FFindPathPtr | FindHierarchicalPathImplementation | ||
| FFindPathPtr | FindPathImplementation | ||
| FNavDataConfig | NavDataConfig | ||
| TSharedPtr< FNavDataGenerator, ESPMode::ThreadSafe > | NavDataGenerator | ||
| float | NextObservedPathsTickInSeconds | Contains how much time left to the next ObservedPaths processing | |
| TArray< FNavPathWeakPtr > | ObservedPaths | Contains paths that requested observing its goal's location. | |
| float | ObservedPathsTickInterval | All observed paths will be processed every ObservedPathsTickInterval seconds | |
| TMap< UClass *, FSharedConstNavQueryFilter > | QueryFilters | Map of query filters by UNavigationQueryFilter class | |
| FNavRaycastPtr | RaycastImplementation | ||
| TObjectPtr< UPrimitiveComponent > | RenderingComp | ||
| TArray< FNavPathRecalculationRequest > | RepathRequests | Paths that requested re-calculation | |
| ERuntimeGenerationType | RuntimeGeneration | Navigation data runtime generation options | |
| TArray< FSupportedAreaData > | SupportedAreas | Serialized area class - ID mapping | |
| TArray< FNavigationDirtyArea > | SuspendedDirtyAreas | Caches requests to rebuild dirty areas while nav rebuilding is suspended via SetRebuildingSuspended(true) call. | |
| FTestPathPtr | TestHierarchicalPathImplementation | ||
| FTestPathPtr | TestPathImplementation |
Constructors
| Type | Name | Description | |
|---|---|---|---|
ANavigationData
(
const FObjectInitializer& ObjectInitializer |
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | BatchProjectPoints
(
TArray< FNavigationProjectionWork >& Workload, |
Project batch of points using shared search filter. | |
| void | BatchProjectPoints
(
TArray< FNavigationProjectionWork >& Workload, |
Batches ProjectPoint's work for efficiency | |
| void | BatchRaycast
(
TArray< FNavigationRaycastWork >& Workload, |
Raycasts batched for efficiency | |
| void | Batch processing (important with async rebuilding) | ||
| ENavigationQueryResult::Type | CalcPathCost
(
const FVector& PathStart, |
Calculates path from PathStart to PathEnd and retrieves its cost. | |
| ENavigationQueryResult::Type | CalcPathLength
(
const FVector& PathStart, |
Calculates path from PathStart to PathEnd and retrieves its length. | |
| ENavigationQueryResult::Type | CalcPathLengthAndCost
(
const FVector& PathStart, |
Calculates path from PathStart to PathEnd and retrieves its length. | |
| bool | |||
| void | CancelBuild () |
Cancels current build | |
| bool | |||
| void | CleanUp () |
||
| void | |||
| void | Creates new generator in case navigation supports it | ||
| UPrimitiveComponent * | All the rest | ||
| FNavPathSharedPtr | CreatePathInstance
(
const FPathFindingQueryData& QueryData |
Created an instance of navigation path of specified type. | |
| bool | DoesNodeContainLocation
(
NavNodeRef NodeRef, |
Checks if specified navigation node contains given location | |
| bool | DoesSupportAgent
(
const FNavAgentProperties& AgentProps |
||
| void | Blocks until navigation build is complete | ||
| void | FillConfig
(
FNavDataConfig& Dest |
||
| void | FillNavigationDataChunkActor
(
const FBox& QueryBounds, |
||
| FPathFindingResult | FindHierarchicalPath
(
const FNavAgentProperties& AgentProperties, |
Synchronously looks for a path from to for agent with properties . | |
| bool | FindOverlappingEdges
(
const FNavLocation& StartLocation, |
Returns the navmesh edges that touch the convex polygon. The edges are not clipped by the polygon. | |
| FPathFindingResult | FindPath
(
const FNavAgentProperties& AgentProperties, |
Synchronously looks for a path from to for agent with properties . | |
| void | Finishes batch processing and release locks | ||
| const UClass * | GetAreaClass
(
int32 AreaID |
Get class associated with AreaID | |
| int32 | Get ID assigned to AreaClas or -1 when not assigned | ||
| FBox | GetBounds () |
Returns bounding box for the navmesh. | |
| const FNavDataConfig & | GetConfig () |
Generation & data access. | |
| FVector | |||
| FSharedConstNavQueryFilter | Querying. | ||
| const INavigationQueryFilterInterface * | |||
| FNavDataGenerator * | GetGenerator () |
Retrieves navigation data generator | |
| const FNavDataGenerator * | GetGenerator () |
||
| int32 | Get max areas supported by this navigation data | ||
| uint16 | |||
| TArray< FBox > | Returns list of navigable bounds. | ||
| TArray< FBox > | GetNavigableBoundsInLevel
(
ULevel* InLevel |
Returns list of navigable bounds that belongs to specific level | |
| int32 | GetNewAreaID
(
const UClass* AreaClass |
Get ID to assign for newly added area | |
| int32 | Retrieves the number of suspended dirty areas | ||
| bool | GetPathSegmentBoundaryEdges
(
const FNavigationPath& Path, |
Searches navmesh edges between the two path points, search up to the convex polygon described in SearchArea. | |
| FSharedConstNavQueryFilter | GetQueryFilter
(
TSubclassOf< UNavigationQueryFilter > FilterClass |
Filters. | |
| FNavLocation | GetRandomPoint
(
FSharedConstNavQueryFilter Filter, |
||
| bool | GetRandomPointInNavigableRadius
(
const FVector& Origin, |
Finds a random location in navigable space, in given Radius | |
| bool | GetRandomReachablePointInRadius
(
const FVector& Origin, |
Finds a random location in Radius, reachable from Origin | |
| ERuntimeGenerationType | |||
| void | GetSupportedAreas
(
TArray< FSupportedAreaData >& Areas |
Read all supported areas | |
| double | |||
| double | |||
| void | |||
| bool | IsAreaAssigned
(
int32 AreaID |
Check if AreaID was assigned to class (class itself may not be loaded yet!) | |
| bool | |||
| bool | |||
| bool | Retrieves if this NavData instance's navigation generation is suspended | ||
| bool | IsRegistered () |
||
| bool | |||
| void | Any loading before NavDataGenerator->RebuildAll() | ||
| uint32 | LogMemUsed () |
||
| bool | NeedsRebuild () |
||
| bool | |||
| void | OnNavAreaAdded
(
const UClass* NavAreaClass, |
Areas. | |
| void | Called after changes to registered area classes | ||
| void | OnNavAreaEvent
(
const UClass* NavAreaClass, |
||
| void | OnNavAreaRemoved
(
const UClass* NavAreaClass |
Area was removed from navigation system | |
| void | |||
| void | OnRegistered () |
||
| void | OnStreamingLevelAdded
(
ULevel* InLevel, |
||
| void | OnStreamingLevelRemoved
(
ULevel* InLevel, |
||
| void | OnStreamingNavDataAdded
(
ANavigationDataChunkActor& InActor |
||
| void | OnStreamingNavDataRemoved
(
ANavigationDataChunkActor& InActor |
||
| void | |||
| void | ProcessNavAreas
(
const TSet< const UClass* >& AreaClasses, |
Add all existing areas | |
| void | Removes from ActivePaths all paths that no longer have shared references (and are invalid in fact) | ||
| bool | Synchronously makes a raycast on navigation data using QueryFilter | ||
| void | RebuildAll () |
Triggers rebuild in case navigation supports it | |
| void | RebuildDirtyAreas
(
const TArray< FNavigationDirtyArea >& DirtyAreas |
Request navigation data update after changes in nav octree | |
| void | RegisterActivePath
(
FNavPathSharedPtr SharedPath |
||
| void | Releases navigation generator if any has been created register self with navigation system as new NavAreaDefinition(s) observer | ||
| void | RegisterObservedPath
(
FNavPathSharedPtr SharedPath |
||
| void | RemoveQueryFilter
(
TSubclassOf< UNavigationQueryFilter > FilterClass |
Removes cached query filter | |
| void | |||
| void | RequestRePath
(
FNavPathSharedPtr Path, |
||
| void | RestrictBuildingToActiveTiles
(
bool InRestrictBuildingToActiveTiles |
||
| void | SetConfig
(
const FNavDataConfig& Src |
||
| void | SetIsBuildingOnLoad
(
bool bValue |
||
| void | SetNavRenderingEnabled
(
bool bEnable |
Updates state of rendering component | |
| void | SetRebuildingSuspended
(
const bool bNewSuspend |
Configures this NavData instance's navigation generation to be suspended or active. | |
| void | SetSupportsDefaultAgent
(
bool bIsDefault |
||
| void | StoreQueryFilter
(
TSubclassOf< UNavigationQueryFilter > FilterClass, |
Store cached query filter | |
| bool | |||
| bool | |||
| bool | TestHierarchicalPath
(
const FNavAgentProperties& AgentProperties, |
Synchronously checks if path between two points exists using hierarchical graph FNavAgentProperties will be found automatically | |
| bool | TestPath
(
const FNavAgentProperties& AgentProperties, |
Synchronously checks if path between two points exists FNavAgentProperties will be found automatically | |
| void | TickAsyncBuild
(
float DeltaSeconds |
Ticks navigation build If the generator is set to time sliced rebuild then this function will only get called when there is sufficient time (effectively roughly once in n frames where n is the number of time sliced nav data generators currently building) | |
| void | UpdateCustomLink
(
const INavLinkCustomInterface* CustomLink |
Custom navigation links. |
Overridden from AActor
| Type | Name | Description | |
|---|---|---|---|
| void | ApplyWorldOffset
(
const FVector& InOffset, |
Called by owning level to shift an actor location and all relevant data structures by specified delta | |
| bool | Returns true if this actor allows changing the spatially loaded flag. | ||
| void | Destroyed () |
Called when this actor is explicitly being destroyed during gameplay or in the editor, not called during level streaming or gameplay ending | |
| void | EndPlay
(
const EEndPlayReason::Type EndPlayReason |
Overridable function called whenever this actor is being removed from a level | |
| void | Allow actors to initialize themselves on the C++ side after all of their components have been initialized, only called during gameplay | ||
| void | Rerun construction scripts, destroying all autogenerated components; will attempt to preserve the root component location. | ||
| void | TickActor
(
float DeltaTime, |
Dispatches the once-per frame Tick() function for this actor |
Overridden from UObject
| Type | Name | Description | |
|---|---|---|---|
| void | PostEditUndo () |
Called after applying a transaction to the object. | |
| void | Life cycle. | ||
| void | PostLoad () |
Do any object-specific cleanup required immediately after loading an object. |
Overridden from INavigationDataInterface
| Type | Name | Description | |
|---|---|---|---|
| bool | FindMoveAlongSurface
(
const FNavLocation& StartLocation, |
Tries to move current nav location towards target constrained to navigable area. | |
| bool | ProjectPoint
(
const FVector& Point, |
Tries to project given Point to this navigation type, within given Extent. |
Typedefs
| Name | Description |
|---|---|
| FFindPathPtr | |
| FNavRaycastPtr | |
| FTestPathPtr |
Deprecated Variables
| Type | Name | Description | |
|---|---|---|---|
| uint32: 1 | bRebuildAtRuntime_DEPRECATED | If true, the NavMesh can be dynamically rebuilt at runtime. |
Deprecated Functions
| Type | Name | Description | |
|---|---|---|---|
| ENavigationQueryResult::Type | CalcPathCost
(
const FVector& PathStart, |
Use new version with FVector::FReal | |
| ENavigationQueryResult::Type | CalcPathLength
(
const FVector& PathStart, |
Use new version with FVector::FReal | |
| ENavigationQueryResult::Type | CalcPathLengthAndCost
(
const FVector& PathStart, |
Use new version with FVector::FReal | |
| void | DrawDebugPath
(
FNavigationPath* Path, |
Use version that takes LifeTime instead. | |
| void | DrawDebugPath
(
FNavigationPath* Path, |
Use version that takes LifeTime instead. |