NavMeshΒΆ
Inherited: Resource
DescriptionΒΆ
A navigation mesh resource owns the Detour mesh and its query object. It can load and save serialized tile data and provides access to the mesh, query object, and tile reference used by the navigation system.
Public MethodsΒΆ
NavMesh () |
|
~NavMesh () |
|
void |
cleanup () |
void |
loadUserData (const VariantMap & data) |
dtNavMesh * |
navMesh () const |
dtNavMeshQuery * |
query () const |
VariantMap |
saveUserData () const |
bool |
setData (const ByteArray & data) |
dtTileRef |
tileRef (int tileX, int tileY) const |
Static MethodsΒΆ
None
Methods DescriptionΒΆ
NavMesh::NavMesh ()
Constructs an empty navigation mesh resource.
NavMesh::~NavMesh ()
Destroys the navigation mesh resource and releases its Detour objects.
void NavMesh::cleanup ()
Releases the Detour navigation mesh and query objects owned by the resource.
void NavMesh::loadUserData (VariantMap & data)
Reimplements: Object::loadUserData(const VariantMap &data).
Loads serialized navigation mesh tile data from resource user data.
The data map contains the serialized resource user data and its tile data.
dtNavMesh * NavMesh::navMesh () const
Returns the underlying Detour navigation mesh, or nullptr when it is not loaded.
dtNavMeshQuery * NavMesh::query () const
Returns the Detour navigation query object, or nullptr when it is not initialized.
VariantMap NavMesh::saveUserData () const
Reimplements: Object::saveUserData() const.
Saves the first available navigation mesh tile as resource user data.
bool NavMesh::setData (ByteArray & data)
Loads serialized Detour tile data into the navigation mesh.
The data replaces the currently loaded tile. The method returns true when it is added successfully, or false when the data is invalid or Detour rejects the tile.
dtTileRef NavMesh::tileRef (int tileX, int tileY) const
Returns the Detour reference for the tile at coordinates tileX and tileY.
Returns zero when the navigation mesh is not loaded or no tile exists at the requested coordinates.