FNavLocalGridData

Local navigation grid - simple 2D grid used for navigation.

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

AIModule

Header

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

Include

#include "Navigation/NavLocalGridData.h"

Syntax

struct FNavLocalGridData : public TSimpleCellGrid< uint8,((uint8) 0xff) >

Remarks

Local navigation grid - simple 2D grid used for navigation.

Cell can be either free or marked as obstacle, connected with 8 neighbors (no walls in between)

When used as source for UNavLocalGridManager, each obstacle should define its own grid data. Corresponding category in gameplay debugger is hidden by default, please adjust project configs to change that.

TODO: helpers for marking different basic shapes TODO: serialization (with maps?) TODO: FNavigationPath support?

Variables

Name Description

Protected variable

TArray< float >

 

CellZ

Protected variable

float

 

LastAccessTime

Constructors

Name Description

Public function

FNavLocalGridData()

Public function

FNavLocalGridData

(
    const TArray< FNavLocalGridData >&...
)

Public function

FNavLocalGridData

(
    const FVector& Center,
    float Extent2D
)

Public function

FNavLocalGridData

(
    const FVector& Center,
    const FVector2D& Extent2D
)

Functions

Name Description

Public function Const

bool

 

FindPath

(
    const FIntVector& StartCoords,
    const FIntVector& EndCoords,
    TArray< FIntVector >& PathCoords
)

Create path points from StartCoords to EndCoord, returns false when failed

Public function Const

void

 

FindPathForMovingAgent

(
    const FNavigationPath& SourcePath,
    const FVector& EntryLocation,
    int32 EntrySegmentStart,
    TArray< FVector >& PathPointsInsid...,
    int32& NextSegmentStart
)

Creates path points from navigation path going through grid

Public function Const

int32

 

GetCellIndexFromGlobalCoords2D

(
    const FIntVector& WorldCoords
)

Convert global world coords to cell index, return -1 if outside

Public function Const

FIntVector

 

GetGlobalCoords

(
    int32 CellIdx
)

Convert cell index to global world coords with origin in (0,0,0)

Public function Const

const int32

 

GetGridId()

Get unique Id of grid

Public function Const

FNodeRef

 

GetNeighbour

(
    const FNodeRef NodeRef,
    const int32 NeiIndex
)

Public function Const

int32

 

GetNeighbourCount

(
    FNodeRef NodeRef
)

Public function Const

FVector

 

GetProjectedCellCenter

(
    int32 LocationX,
    int32 LocationY
)

Convert cell coords on grid to world location using projected heights

Public function Const

FVector

 

GetProjectedCellCenter

(
    int32 CellIdx
)

Convert cell index to world location using projected heights

Public function Const

bool

 

HasObstacleUnsafe

(
    int32 LocationX,
    int32 LocationY
)

Check if there's an obstacle at cell coords

Protected function Const

bool

 

IsLineObstructed

(
    const FIntVector& StartCoords,
    const FIntVector& EndCoords
)

Check if line trace between local coords on grid hits any obstacles, doesn't validate coords!

Public function Const

bool

 

IsValidRef

(
    FNodeRef NodeRef
)

Public function

void

 

MarkBoxObstacle

(
    const FVector& Center,
    const FVector& Extent,
    const FQuat& Quat
)

Mark box (AABB or rotated) shape as obstacle

Public function

void

 

MarkCapsuleObstacle

(
    const FVector& Center,
    float Radius,
    float HalfHeight
)

Mark capsule shape as obstacle

Public function

void

 

MarkPointObstacle

(
    const FVector& Center
)

Mark single cell as obstacle

Protected function Const

void

 

PostProcessPath

(
    const FIntVector& StartCoords,
    const FIntVector& EndCoords,
    const TArray< int32 >& PathIndices,
    TArray< FIntVector >& PathCoords
)

Convert PathIndices into pruned PathCoords

Public function

void

 

ProjectCells

(
    const ANavigationData& NavData
)

Project cells on navigation data and marks failed ones as obstacles

Protected function

void

 

SetGridId

(
    int32 NewId
)

Set unique Id of grid

Public function

void

 

SetHeight

(
    float ExtentZ
)

Set height of bounds, if not set: ProjectCells will use height of default query box

Typedefs

Name

Description

FNodeRef

FGraphAStar: TGraph.