Navigation
API > API/Runtime > API/Runtime/Navmesh
A navigation mesh based on tiles of convex polygons.
The navigation mesh consists of one or more tiles defining three primary types of structural data:
A polygon mesh which defines most of the navigation graph. (See rcPolyMesh for its structure.) A detail mesh used for determining surface height on the polygon mesh. (See rcPolyMeshDetail for its structure.) Off-mesh connections, which define custom point-to-point edges within the navigation graph.
The general build process is as follows:
Create rcPolyMesh and rcPolyMeshDetail data using the Recast build pipeline.
Optionally, create off-mesh connection data.
Combine the source data into a dtNavMeshCreateParams structure.
Create a tile data array using dtCreateNavMeshData().
Allocate at dtNavMesh object and initialize it. (For single tile navigation meshes, the tile data is loaded during this step.)
For multi-tile navigation meshes, load the tile data using dtNavMesh::addTile().
Notes:
- This class is usually used in conjunction with the dtNavMeshQuery class for pathfinding.
- Technically, all navigation meshes are tiled. A 'solo' mesh is simply a navigation mesh initialized to have only a single tile.
- This class does not implement any asynchronous methods. So the dtStatus result of all methods will always contain either a success or failure flag.
| Name | dtNavMesh |
| Type | class |
| Header File | /Engine/Source/Runtime/Navmesh/Public/Detour/DetourNavMesh.h |
| Include Path | #include "Detour/DetourNavMesh.h" |
Syntax
class dtNavMesh
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
dtNavMesh() |
Detour/DetourNavMesh.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
~dtNavMesh() |
Detour/DetourNavMesh.h |
Structs
| Name | Remarks |
|---|---|
| FConnectingPolyData | [UE] result struct for findConnectingPolys |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| m_areaCostOrder | unsigned char | Detour/DetourNavMesh.h | ||
| m_maxTiles | int | Max number of tiles. | Detour/DetourNavMesh.h | |
| m_nextFree | dtMeshTile * | Freelist of tiles. | Detour/DetourNavMesh.h | |
| m_orig | dtReal | Origin of the tile (0,0) | Detour/DetourNavMesh.h | |
| m_params | dtNavMeshParams | Current initialization params. | Detour/DetourNavMesh.h | |
| m_polyBits | unsigned int | Number of poly bits in the tile ID. | Detour/DetourNavMesh.h | |
| m_posLookup | dtMeshTile ** | Tile hash lookup. | Detour/DetourNavMesh.h | |
| m_saltBits | unsigned int | Number of salt bits in the tile ID. | Detour/DetourNavMesh.h | |
| m_tileBits | unsigned int | Number of tile bits in the tile ID. | Detour/DetourNavMesh.h | |
| m_tileHeight | dtReal | Dimensions of each tile. | Detour/DetourNavMesh.h | |
| m_tileLutMask | int | Tile hash lookup mask. | Detour/DetourNavMesh.h | |
| m_tileLutSize | int | Tile hash lookup size (must be pot). | Detour/DetourNavMesh.h | |
| m_tiles | dtMeshTile * | List of tiles. | Detour/DetourNavMesh.h | |
| m_tileWidth | dtReal | Detour/DetourNavMesh.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
dtStatus addTile
(
unsigned char* data, |
Adds a tile to the navigation mesh. | Detour/DetourNavMesh.h | |
void applyAreaCostOrder
(
unsigned char* costOrder |
Detour/DetourNavMesh.h | ||
void applyWorldOffset
(
const dtReal* offset |
Shift navigation mesh by provided offset. | Detour/DetourNavMesh.h | |
void calcTileLoc
(
const dtReal* pos, |
Calculates the tile grid location for the specified world position. | Detour/DetourNavMesh.h | |
unsigned int decodeClusterIdTile
(
dtClusterRef ref |
Extracts the tile's index from the specified cluster reference. | Detour/DetourNavMesh.h | |
void decodePolyId
(
dtPolyRef ref, |
Decodes a standard polygon reference. This function is generally meant for internal use only. | Detour/DetourNavMesh.h | |
unsigned int decodePolyIdPoly
(
dtPolyRef ref |
Extracts the polygon's index (within its tile) from the specified polygon reference. | Detour/DetourNavMesh.h | |
unsigned int decodePolyIdSalt
(
dtPolyRef ref |
Extracts a tile's salt value from the specified polygon reference. | Detour/DetourNavMesh.h | |
unsigned int decodePolyIdTile
(
dtPolyRef ref |
Extracts the tile's index from the specified polygon reference. | Detour/DetourNavMesh.h | |
dtPolyRef encodePolyId
(
unsigned int salt, |
Derives a standard polygon reference. This function is generally meant for internal use only. | Detour/DetourNavMesh.h | |
dtReal getBVQuantFactor
(
const unsigned char resolution |
Detour/DetourNavMesh.h | ||
dtClusterRef getClusterRefBase
(
const dtMeshTile* tile |
Gets the cluster reference for the tile's base cluster. | Detour/DetourNavMesh.h | |
dtLink & getLink
(
dtMeshTile* tile, |
Helper for accessing links. | Detour/DetourNavMesh.h | |
const dtLink & getLink
(
const dtMeshTile* tile, |
Detour/DetourNavMesh.h | ||
int getMaxTiles() |
The maximum number of tiles supported by the navigation mesh. | Detour/DetourNavMesh.h | |
dtMeshTile * getMutableTileByRef
(
dtTileRef ref |
Gets the tile for the specified tile reference. | Detour/DetourNavMesh.h | |
bool getNeighbourCoords
(
const int x, |
Detour/DetourNavMesh.h | ||
int getNeighbourTilesCountAt
(
const int x, |
Returns neighbour tile count based on side of given tile. | Detour/DetourNavMesh.h | |
const dtOffMeshConnection * getOffMeshConnectionByRef
(
dtPolyRef ref |
Gets the specified off-mesh connection: point type. | Detour/DetourNavMesh.h | |
dtStatus getOffMeshConnectionPolyEndPoints
(
dtPolyRef prevRef, |
Gets the endpoints for an off-mesh connection, ordered by "direction of travel". | Detour/DetourNavMesh.h | |
const dtNavMeshParams * getParams () |
The navigation mesh initialization params. | Detour/DetourNavMesh.h | |
dtStatus getPolyArea
(
dtPolyRef ref, |
Gets the user defined area for the specified polygon. | Detour/DetourNavMesh.h | |
dtStatus getPolyFlags
(
dtPolyRef ref, |
Gets the user defined flags for the specified polygon. | Detour/DetourNavMesh.h | |
dtPolyRef getPolyRefBase
(
const dtMeshTile* tile |
Gets the polygon reference for the tile's base polygon. | Detour/DetourNavMesh.h | |
unsigned int getSaltBits() |
Detour/DetourNavMesh.h | ||
const dtMeshTile * getTile
(
int i |
Gets the tile at the specified index. | Detour/DetourNavMesh.h | |
dtStatus getTileAndPolyByRef
(
const dtPolyRef ref, |
Gets the tile and polygon for the specified polygon reference. | Detour/DetourNavMesh.h | |
void getTileAndPolyByRefUnsafe
(
const dtPolyRef ref, |
Returns the tile and polygon for the specified polygon reference. | Detour/DetourNavMesh.h | |
const dtMeshTile * getTileAt
(
const int x, |
Gets the tile at the specified grid location. | Detour/DetourNavMesh.h | |
const dtMeshTile * getTileByRef
(
dtTileRef ref |
Gets the tile for the specified tile reference. | Detour/DetourNavMesh.h | |
int getTileCountAt
(
const int x, |
@UE BEGIN Gets number of tiles at the specified grid location. (All layers.) | Detour/DetourNavMesh.h | |
unsigned int getTileIndex
(
const dtMeshTile* tile |
Detour/DetourNavMesh.h | ||
dtTileRef getTileRef
(
const dtMeshTile* tile |
Gets the tile reference for the specified tile. | Detour/DetourNavMesh.h | |
dtTileRef getTileRefAt
(
int x, |
Gets the tile reference for the tile at specified grid location. | Detour/DetourNavMesh.h | |
int getTilesAt
(
const int x, |
Gets all tiles at the specified grid location. | Detour/DetourNavMesh.h | |
int getTileStateSize
(
const dtMeshTile* tile |
Gets the size of the buffer required by storeTileState to store the specified tile's state. | Detour/DetourNavMesh.h | |
dtReal getWalkableClimb() |
Detour/DetourNavMesh.h | ||
dtReal getWalkableHeight() |
Detour/DetourNavMesh.h | ||
dtReal getWalkableRadius() |
Detour/DetourNavMesh.h | ||
dtStatus init
(
const dtNavMeshParams* params |
Initializes the navigation mesh for tiled use. | Detour/DetourNavMesh.h | |
dtStatus init
(
unsigned char* data, |
Initializes the navigation mesh for single tile use. | Detour/DetourNavMesh.h | |
bool isEmpty() |
Detour/DetourNavMesh.h | ||
bool isTileLocInValidRange
(
const dtReal* pos |
Calculates whether the tile grid location for the specified world position can fit in the tile indices type (currently an int) | Detour/DetourNavMesh.h | |
bool isValidPolyRef
(
dtPolyRef ref |
Checks the validity of a polygon reference. | Detour/DetourNavMesh.h | |
void linkOffMeshHelper
(
dtMeshTile* tile0, |
Helper for creating links in off-mesh connections. | Detour/DetourNavMesh.h | |
dtStatus removeTile
(
dtTileRef ref, |
Removes the specified tile from the navigation mesh. | Detour/DetourNavMesh.h | |
dtStatus restoreTileState
(
dtMeshTile* tile, |
Restores the state of the tile. | Detour/DetourNavMesh.h | |
dtStatus setPolyArea
(
dtPolyRef ref, |
Sets the user defined area for the specified polygon. | Detour/DetourNavMesh.h | |
dtStatus setPolyFlags
(
dtPolyRef ref, |
Sets the user defined flags for the specified polygon. | Detour/DetourNavMesh.h | |
dtStatus storeTileState
(
const dtMeshTile* tile, |
Stores the non-structural state of the tile in the specified buffer. | Detour/DetourNavMesh.h | |
void updateOffMeshConnectionByUserId
(
unsigned long long int userId, |
Updates area and flags for specified off-mesh connection: point type | Detour/DetourNavMesh.h |
See Also
-
dtCreateNavMeshData
-
dtAllocNavMesh
-
dtFreeNavMesh