engine
 
载入中...
搜索中...
未找到
Public 成员函数 | Protected 成员函数 | 友元 | 所有成员列表
FNavLocalGridData结构体 参考

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

#include <NavLocalGridData.h>

+ 类 FNavLocalGridData 继承关系图:

Public 成员函数

bool FindPath (const FIntVector &StartCoords, const FIntVector &EndCoords, TArray< FIntVector > &PathCoords) const
 create path points from StartCoords to EndCoord, returns false when failed
 
void FindPathForMovingAgent (const FNavigationPath &SourcePath, const FVector &EntryLocation, int32 EntrySegmentStart, TArray< FVector > &PathPointsInside, int32 &NextSegmentStart) const
 creates path points from navigation path going through grid 更多...
 
int32 GetCellIndexFromGlobalCoords2D (const FIntVector &WorldCoords) const
 convert global world coords to cell index, return -1 if outside
 
FIntVector GetGlobalCoords (int32 CellIdx) const
 convert cell index to global world coords with origin in (0,0,0)
 
const int32 GetGridId () const
 get unique Id of grid
 
FVector GetProjectedCellCenter (int32 CellIdx) const
 convert cell index to world location using projected heights
 
FVector GetProjectedCellCenter (int32 LocationX, int32 LocationY) const
 convert cell coords on grid to world location using projected heights
 
bool HasObstacleUnsafe (int32 LocationX, int32 LocationY) const
 check if there's an obstacle at cell coords
 
void MarkBoxObstacle (const FVector &Center, const FVector &Extent, const FQuat &Quat=FQuat::Identity)
 mark box (AABB or rotated) shape as obstacle
 
void MarkCapsuleObstacle (const FVector &Center, float Radius, float HalfHeight)
 mark capsule shape as obstacle
 
void MarkPointObstacle (const FVector &Center)
 mark single cell as obstacle
 
void ProjectCells (const ANavigationData &NavData)
 project cells on navigation data and marks failed ones as obstacles
 
void SetHeight (float ExtentZ)
 set height of bounds, if not set: ProjectCells will use height of default query box
 
- Public 成员函数 继承自 TSimpleCellGrid< uint8, MAX_uint8 >
FIntVector GetCellCoords (const FVector &WorldLocation) const
 Convert world location to (X,Y) coords on grid, result is clamped to grid
 
FORCEINLINE FIntVector GetCellCoords (int32 CellIndex) const
 Convert cell index to (X,Y) coords on grid
 
FORCEINLINE FIntVector GetCellCoordsUnsafe (const FVector &WorldLocation) const
 Convert world location to (X,Y) coords on grid, result can be outside grid
 
FORCEINLINE int32 GetCellCoordX (int32 CellIndex) const
 Convert cell index to coord X on grid, result can be invalid
 
FORCEINLINE int32 GetCellCoordY (int32 CellIndex) const
 Convert cell index to coord Y on grid, result can be invalid
 
int32 GetCellIndex (const FVector &WorldLocation) const
 Convert world location to cell index, returns -1 for position outside grid
 
FORCEINLINE int32 GetCellIndex (int32 LocationX, int32 LocationY) const
 Convert (X,Y) coords on grid to cell index, returns -1 for position outside grid
 
FORCEINLINE int32 GetCellIndexUnsafe (const FIntVector &CellCoords) const
 Convert (X,Y) coords on grid to cell index, result can be invalid
 
int32 GetCellIndexUnsafe (const FVector &WorldLocation) const
 Convert world location to cell index, result can be invalid
 
FORCEINLINE int32 GetCellIndexUnsafe (int32 LocationX, int32 LocationY) const
 Convert (X,Y) coords on grid to cell index, result can be invalid
 

Protected 成员函数

bool IsLineObstructed (const FIntVector &StartCoords, const FIntVector &EndCoords) const
 check if line trace between local coords on grid hits any obstacles, doesn't validate coords!
 
void PostProcessPath (const FIntVector &StartCoords, const FIntVector &EndCoords, const TArray< int32 > &PathIndices, TArray< FIntVector > &PathCoords) const
 convert PathIndices into pruned PathCoords
 
void SetGridId (int32 NewId)
 set unique Id of grid
 

友元

class UNavLocalGridManager
 

详细描述

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?

成员函数说明

◆ 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

参数
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

该结构体的文档由以下文件生成: