Navigation
API > API/Runtime > API/Runtime/Navmesh > API/Runtime/Navmesh/Detour
References
| Module | Navmesh |
| Header | /Engine/Source/Runtime/Navmesh/Public/Detour/DetourNavMesh.h |
| Include | #include "Detour/DetourNavMesh.h" |
Syntax
class dtNavMesh
Remarks
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.
Variables
| Type | Name | Description | |
|---|---|---|---|
| unsigned char[DT_MAX_AREAS] | m_areaCostOrder | ||
| int | m_maxTiles | Max number of tiles. | |
| dtMeshTile * | m_nextFree | Freelist of tiles. | |
| dtReal[3] | m_orig | Origin of the tile (0,0) | |
| dtNavMeshParams | m_params | Current initialization params. | |
| unsigned int | m_polyBits | Number of poly bits in the tile ID. | |
| dtMeshTile ** | m_posLookup | Tile hash lookup. | |
| unsigned int | m_saltBits | Number of salt bits in the tile ID. | |
| unsigned int | m_tileBits | Number of tile bits in the tile ID. | |
| dtReal | m_tileHeight | Dimensions of each tile. | |
| int | m_tileLutMask | Tile hash lookup mask. | |
| int | m_tileLutSize | Tile hash lookup size (must be pot). | |
| dtMeshTile * | m_tiles | List of tiles. | |
| dtReal | m_tileWidth |
Constructors
| Type | Name | Description | |
|---|---|---|---|
dtNavMesh () |
Destructors
| Type | Name | Description | |
|---|---|---|---|
~dtNavMesh () |
Functions
| Type | Name | Description | |
|---|---|---|---|
| dtStatus | addTile
(
unsigned char* data, |
Adds a tile to the navigation mesh. | |
| void | applyAreaCostOrder
(
unsigned char* costOrder |
||
| void | applyWorldOffset
(
const dtReal* offset |
Shift navigation mesh by provided offset. | |
| void | calcTileLoc
(
const dtReal* pos, |
Calculates the tile grid location for the specified world position. | |
| unsigned int | decodeClusterIdTile
(
dtClusterRef ref |
Extracts the tile's index from the specified cluster reference. | |
| void | decodePolyId
(
dtPolyRef ref, |
Decodes a standard polygon reference. This function is generally meant for internal use only. | |
| unsigned int | decodePolyIdPoly
(
dtPolyRef ref |
Extracts the polygon's index (within its tile) from the specified polygon reference. | |
| unsigned int | decodePolyIdSalt
(
dtPolyRef ref |
Extracts a tile's salt value from the specified polygon reference. | |
| unsigned int | decodePolyIdTile
(
dtPolyRef ref |
Extracts the tile's index from the specified polygon reference. | |
| dtPolyRef | encodePolyId
(
unsigned int salt, |
Derives a standard polygon reference. This function is generally meant for internal use only. | |
| dtReal | getBVQuantFactor
(
const unsigned char resolution |
||
| dtClusterRef | getClusterRefBase
(
const dtMeshTile* tile |
Gets the cluster reference for the tile's base cluster. | |
| dtLink & | getLink
(
dtMeshTile* tile, |
Helper for accessing links. | |
| const dtLink & | getLink
(
const dtMeshTile* tile, |
||
| int | getMaxTiles () |
The maximum number of tiles supported by the navigation mesh. | |
| bool | getNeighbourCoords
(
const int x, |
||
| int | getNeighbourTilesCountAt
(
const int x, |
Returns neighbour tile count based on side of given tile. | |
| const dtOffMeshConnection * | getOffMeshConnectionByRef
(
dtPolyRef ref |
Gets the specified off-mesh connection: point type. | |
| dtStatus | getOffMeshConnectionPolyEndPoints
(
dtPolyRef prevRef, |
Gets the endpoints for an off-mesh connection, ordered by "direction of travel". | |
| const dtNavMeshParams * | getParams () |
The navigation mesh initialization params. | |
| dtStatus | getPolyArea
(
dtPolyRef ref, |
Gets the user defined area for the specified polygon. | |
| dtStatus | getPolyFlags
(
dtPolyRef ref, |
Gets the user defined flags for the specified polygon. | |
| dtPolyRef | getPolyRefBase
(
const dtMeshTile* tile |
Gets the polygon reference for the tile's base polygon. | |
| unsigned int | getSaltBits () |
||
| const dtMeshTile * | getTile
(
int i |
Gets the tile at the specified index. | |
| dtStatus | getTileAndPolyByRef
(
const dtPolyRef ref, |
Gets the tile and polygon for the specified polygon reference. | |
| void | getTileAndPolyByRefUnsafe
(
const dtPolyRef ref, |
Returns the tile and polygon for the specified polygon reference. | |
| const dtMeshTile * | getTileAt
(
const int x, |
Gets the tile at the specified grid location. | |
| const dtMeshTile * | getTileByRef
(
dtTileRef ref |
Gets the tile for the specified tile reference. | |
| int | getTileCountAt
(
const int x, |
BEGIN Gets number of tiles at the specified grid location. (All layers.) | |
| unsigned int | getTileIndex
(
const dtMeshTile* tile |
||
| dtTileRef | getTileRef
(
const dtMeshTile* tile |
Gets the tile reference for the specified tile. | |
| dtTileRef | getTileRefAt
(
int x, |
Gets the tile reference for the tile at specified grid location. | |
| int | getTilesAt
(
const int x, |
Gets all tiles at the specified grid location. | |
| int | getTileStateSize
(
const dtMeshTile* tile |
Gets the size of the buffer required by storeTileState to store the specified tile's state. | |
| dtReal | |||
| dtReal | |||
| dtReal | |||
| dtStatus | init
(
const dtNavMeshParams* params |
Initializes the navigation mesh for tiled use. | |
| dtStatus | init
(
unsigned char* data, |
Initializes the navigation mesh for single tile use. | |
| bool | isEmpty () |
||
| 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) | |
| bool | isValidPolyRef
(
dtPolyRef ref |
Checks the validity of a polygon reference. | |
| void | linkOffMeshHelper
(
dtMeshTile* tile0, |
Helper for creating links in off-mesh connections. | |
| dtStatus | removeTile
(
dtTileRef ref, |
Removes the specified tile from the navigation mesh. | |
| dtStatus | restoreTileState
(
dtMeshTile* tile, |
Restores the state of the tile. | |
| dtStatus | setPolyArea
(
dtPolyRef ref, |
Sets the user defined area for the specified polygon. | |
| dtStatus | setPolyFlags
(
dtPolyRef ref, |
Sets the user defined flags for the specified polygon. | |
| dtStatus | storeTileState
(
const dtMeshTile* tile, |
Stores the non-structural state of the tile in the specified buffer. | |
| void | updateOffMeshConnectionByUserId
(
unsigned long long int userId, |
Updates area and flags for specified off-mesh connection: point type |
See Also
dtCreateNavMeshData
dtAllocNavMesh
dtFreeNavMesh