UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FNavLocalGridData Struct Reference

#include <NavLocalGridData.h>

+ Inheritance diagram for FNavLocalGridData:

Public Types

typedef int32 FNodeRef
 
- Public Types inherited from TSimpleCellGrid< uint8, MAX_uint8 >
typedef uint8 FCellType
 

Public Member Functions

 FNavLocalGridData ()
 
AIMODULE_API FNavLocalGridData (const FVector &Center, float Extent2D)
 
AIMODULE_API FNavLocalGridData (const FVector &Center, const FVector2D &Extent2D)
 
AIMODULE_API FNavLocalGridData (const TArray< FNavLocalGridData > &SourceGrids)
 
AIMODULE_API void MarkPointObstacle (const FVector &Center)
 
AIMODULE_API void MarkBoxObstacle (const FVector &Center, const FVector &Extent, const FQuat &Quat=FQuat::Identity)
 
AIMODULE_API void MarkCapsuleObstacle (const FVector &Center, float Radius, float HalfHeight)
 
AIMODULE_API void SetHeight (float ExtentZ)
 
const int32 GetGridId () const
 
bool HasObstacleUnsafe (int32 LocationX, int32 LocationY) const
 
FIntVector GetGlobalCoords (int32 CellIdx) const
 
AIMODULE_API int32 GetCellIndexFromGlobalCoords2D (const FIntVector &WorldCoords) const
 
FVector GetProjectedCellCenter (int32 CellIdx) const
 
FVector GetProjectedCellCenter (int32 LocationX, int32 LocationY) const
 
AIMODULE_API void FindPathForMovingAgent (const FNavigationPath &SourcePath, const FVector &EntryLocation, int32 EntrySegmentStart, TArray< FVector > &PathPointsInside, int32 &NextSegmentStart) const
 
AIMODULE_API bool FindPath (const FIntVector &StartCoords, const FIntVector &EndCoords, TArray< FIntVector > &PathCoords) const
 
AIMODULE_API void ProjectCells (const ANavigationData &NavData)
 
int32 GetNeighbourCount (FNodeRef NodeRef) const
 
bool IsValidRef (FNodeRef NodeRef) const
 
AIMODULE_API FNodeRef GetNeighbour (const FNodeRef NodeRef, const int32 NeiIndex) const
 
- Public Member Functions inherited from TSimpleCellGrid< uint8, MAX_uint8 >
 TSimpleCellGrid ()
 
bool Init (const float InCellSize, const FBox &Bounds)
 
bool Init (const float InCellSize, const FGridSize2D &InGridSize, const FVector &InOrigin, const float VerticalBoundSize)
 
void SetVerticalInterval (const FFloatInterval &VerticalInterval)
 
void UpdateWorldBounds ()
 
bool IsValid () const
 
bool IsValidIndex (const int32 CellIndex) const
 
bool IsValidCoord (int32 LocationX, int32 LocationY) const
 
bool IsValidCoord (const FIntVector &CellCoords) const
 
uint32 GetAllocatedSize () const
 
FIntVector GetCellCoordsUnsafe (const FVector &WorldLocation) const
 
FIntVector GetCellCoords (const FVector &WorldLocation) const
 
FIntVector GetCellCoords (int32 CellIndex) const
 
int32 GetCellCoordX (int32 CellIndex) const
 
int32 GetCellCoordY (int32 CellIndex) const
 
int32 GetCellIndexUnsafe (const FVector &WorldLocation) const
 
int32 GetCellIndexUnsafe (const FIntVector &CellCoords) const
 
int32 GetCellIndexUnsafe (int32 LocationX, int32 LocationY) const
 
int32 GetCellIndex (int32 LocationX, int32 LocationY) const
 
int32 GetCellIndex (const FVector &WorldLocation) const
 
FBox GetWorldCellBox (int32 CellIndex) const
 
FBox GetWorldCellBox (int32 LocationX, int32 LocationY) const
 
FBox2D GetWorldCellBox2D (int32 CellIndex) const
 
FBox2D GetWorldCellBox2D (int32 LocationX, int32 LocationY) const
 
FBox GetWorldCellRectangleBox (const FIntRect &CellRect) const
 
FIntRect GetCellRectangleFromBox (const FBox &WorldBox) const
 
FIntRect GetGridRectangle () const
 
FVector GetWorldCellCenter (int32 CellIndex) const
 
FVector GetWorldCellCenter (int32 LocationX, int32 LocationY) const
 
const FCellTypeGetCellAtWorldLocationUnsafe (const FVector &WorldLocation) const
 
const FCellTypeGetCellAtWorldLocation (const FVector &WorldLocation) const
 
FCellTypeoperator[] (int32 CellIndex)
 
const FCellTypeoperator[] (int32 CellIndex) const
 
FCellTypeGetCellAtIndexUnsafe (int32 CellIndex)
 
const FCellTypeGetCellAtIndexUnsafe (int32 CellIndex) const
 
FCellTypeGetCellAtCoordsUnsafe (int32 LocationX, int32 LocationY)
 
const FCellTypeGetCellAtCoordsUnsafe (int32 LocationX, int32 LocationY) const
 
int32 GetCellsCount () const
 
int32 Num () const
 
void Serialize (FArchive &Ar)
 
void AllocateMemory ()
 
void FreeMemory ()
 
void Zero ()
 
void CleanUp ()
 

Protected Member Functions

AIMODULE_API void PostProcessPath (const FIntVector &StartCoords, const FIntVector &EndCoords, const TArray< int32 > &PathIndices, TArray< FIntVector > &PathCoords) const
 
AIMODULE_API bool IsLineObstructed (const FIntVector &StartCoords, const FIntVector &EndCoords) const
 
AIMODULE_API void SetGridId (int32 NewId)
 

Protected Attributes

TArray< FVector::FRealCellZ
 
double LastAccessTime
 
- Protected Attributes inherited from TSimpleCellGrid< uint8, MAX_uint8 >
TArray< FCellTypeCells
 

Friends

class UNavLocalGridManager
 

Additional Inherited Members

- Public Attributes inherited from TSimpleCellGrid< uint8, MAX_uint8 >
float GridCellSize
 
FBox WorldBounds
 
FVector Origin
 
FVector BoundsSize
 
FGridSize2D GridSize
 

Detailed Description

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?

Member Typedef Documentation

◆ FNodeRef

Constructor & Destructor Documentation

◆ FNavLocalGridData() [1/4]

FNavLocalGridData::FNavLocalGridData ( )
inline

◆ FNavLocalGridData() [2/4]

FNavLocalGridData::FNavLocalGridData ( const FVector Center,
float  Extent2D 
)

◆ FNavLocalGridData() [3/4]

FNavLocalGridData::FNavLocalGridData ( const FVector Center,
const FVector2D Extent2D 
)

◆ FNavLocalGridData() [4/4]

FNavLocalGridData::FNavLocalGridData ( const TArray< FNavLocalGridData > &  SourceGrids)

Member Function Documentation

◆ FindPath()

bool FNavLocalGridData::FindPath ( const FIntVector StartCoords,
const FIntVector EndCoords,
TArray< FIntVector > &  PathCoords 
) const

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

◆ FindPathForMovingAgent()

void FNavLocalGridData::FindPathForMovingAgent ( const FNavigationPath SourcePath,
const FVector EntryLocation,
int32  EntrySegmentStart,
TArray< FVector > &  PathPointsInside,
int32 NextSegmentStart 
) const

creates path points from navigation path going through grid

Parameters
SourcePath- [in] full navigation path
EntryLocation- [in] location of agent
EntrySegmentStart- [in] current move segment on path
PathPointsInside- [out] points inside grid
NextSegmentStart- [out] next move segment on path after leaving grid or -1 if path ends inside

◆ GetCellIndexFromGlobalCoords2D()

int32 FNavLocalGridData::GetCellIndexFromGlobalCoords2D ( const FIntVector WorldCoords) const

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

◆ GetGlobalCoords()

FIntVector FNavLocalGridData::GetGlobalCoords ( int32  CellIdx) const
inline

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

◆ GetGridId()

const int32 FNavLocalGridData::GetGridId ( ) const
inline

get unique Id of grid

◆ GetNeighbour()

int32 FNavLocalGridData::GetNeighbour ( const FNodeRef  NodeRef,
const int32  NeiIndex 
) const

◆ GetNeighbourCount()

int32 FNavLocalGridData::GetNeighbourCount ( FNodeRef  NodeRef) const
inline

◆ GetProjectedCellCenter() [1/2]

FVector FNavLocalGridData::GetProjectedCellCenter ( int32  CellIdx) const
inline

convert cell index to world location using projected heights

◆ GetProjectedCellCenter() [2/2]

FVector FNavLocalGridData::GetProjectedCellCenter ( int32  LocationX,
int32  LocationY 
) const
inline

convert cell coords on grid to world location using projected heights

◆ HasObstacleUnsafe()

bool FNavLocalGridData::HasObstacleUnsafe ( int32  LocationX,
int32  LocationY 
) const
inline

check if there's an obstacle at cell coords

◆ IsLineObstructed()

bool FNavLocalGridData::IsLineObstructed ( const FIntVector StartCoords,
const FIntVector EndCoords 
) const
protected

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

◆ IsValidRef()

bool FNavLocalGridData::IsValidRef ( FNodeRef  NodeRef) const
inline

◆ MarkBoxObstacle()

void FNavLocalGridData::MarkBoxObstacle ( const FVector Center,
const FVector Extent,
const FQuat Quat = FQuat::Identity 
)

mark box (AABB or rotated) shape as obstacle

◆ MarkCapsuleObstacle()

void FNavLocalGridData::MarkCapsuleObstacle ( const FVector Center,
float  Radius,
float  HalfHeight 
)

mark capsule shape as obstacle

◆ MarkPointObstacle()

void FNavLocalGridData::MarkPointObstacle ( const FVector Center)

mark single cell as obstacle

◆ PostProcessPath()

void FNavLocalGridData::PostProcessPath ( const FIntVector StartCoords,
const FIntVector EndCoords,
const TArray< int32 > &  PathIndices,
TArray< FIntVector > &  PathCoords 
) const
protected

convert PathIndices into pruned PathCoords

◆ ProjectCells()

void FNavLocalGridData::ProjectCells ( const ANavigationData NavData)

project cells on navigation data and marks failed ones as obstacles

◆ SetGridId()

void FNavLocalGridData::SetGridId ( int32  NewId)
protected

set unique Id of grid

◆ SetHeight()

void FNavLocalGridData::SetHeight ( float  ExtentZ)

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

Friends And Related Symbol Documentation

◆ UNavLocalGridManager

Member Data Documentation

◆ CellZ

TArray<FVector::FReal> FNavLocalGridData::CellZ
protected

◆ LastAccessTime

double FNavLocalGridData::LastAccessTime
protected

The documentation for this struct was generated from the following files: