Plasma Engine  2.0
Loading...
Searching...
No Matches
plAiNavMesh Class Referencefinal

A navmesh generated with a specific configuration. More...

#include <NavMesh.h>

Public Types

using SectorID = plUInt32
 

Public Member Functions

 plAiNavMesh (plUInt32 uiNumSectorsX, plUInt32 uiNumSectorsY, float fSectorMetersXY, const plAiNavmeshConfig &navmeshConfig)
 
plVec2I32 CalculateSectorCoord (float fPositionX, float fPositionY) const
 
plVec2 GetSectorPositionOffset (plVec2I32 vCoord) const
 
plBoundingBox GetSectorBounds (plVec2I32 vCoord, float fMinZ=0.0f, float fMaxZ=1.0f) const
 
float GetSectorSize () const
 
SectorID CalculateSectorID (plVec2I32 vCoord) const
 
plVec2I32 CalculateSectorCoord (SectorID sectorID) const
 
const plAiNavMeshSectorGetSector (SectorID sectorID) const
 
bool RequestSector (SectorID sectorID)
 Marks the sector as requested.
 
bool RequestSector (const plVec2 &vCenter, const plVec2 &vHalfExtents)
 Marks all sectors within the given rectangle as requested.
 
void InvalidateSector (SectorID sectorID, bool bRebuildAsSoonAsPossible)
 Marks the sector as invalidated.
 
void InvalidateSector (const plVec2 &vCenter, const plVec2 &vHalfExtents, bool bRebuildAsSoonAsPossible)
 Marks all sectors within the given rectangle as invalidated.
 
void FinalizeSectorUpdates ()
 
SectorID RetrieveRequestedSector ()
 
void BuildSector (SectorID sectorID, const plNavmeshGeoWorldModuleInterface *pGeo)
 
const dtNavMesh * GetDetourNavMesh () const
 
void DebugDraw (plDebugRendererContext context, const plAiNavigationConfig &config)
 
const plAiNavmeshConfigGetConfig () const
 

Detailed Description

A navmesh generated with a specific configuration.

Each game may use multiple navmeshes for different character types (large, small, etc). All navmeshes always exist, but only some may contain data. You get access to a navmesh through the plAiNavMeshWorldModule.

To do a path search, use plAiNavigation. Since the navmesh is built in the background, a path search may need to run for multiple frames, before it can return any result.

Member Function Documentation

◆ InvalidateSector() [1/2]

void plAiNavMesh::InvalidateSector ( const plVec2 & vCenter,
const plVec2 & vHalfExtents,
bool bRebuildAsSoonAsPossible )

Marks all sectors within the given rectangle as invalidated.

Invalidated sectors are considered out of date and must be rebuilt before they can be used again. If bRebuildAsSoonAsPossible is true, the sector is queued to be rebuilt as soon as possible. Otherwise, it will be unloaded and will not be rebuilt until it is requested again.

◆ InvalidateSector() [2/2]

void plAiNavMesh::InvalidateSector ( SectorID sectorID,
bool bRebuildAsSoonAsPossible )

Marks the sector as invalidated.

Invalidated sectors are considered out of date and must be rebuilt before they can be used again. If bRebuildAsSoonAsPossible is true, the sector is queued to be rebuilt as soon as possible. Otherwise, it will be unloaded and will not be rebuilt until it is requested again.

◆ RequestSector() [1/2]

bool plAiNavMesh::RequestSector ( const plVec2 & vCenter,
const plVec2 & vHalfExtents )

Marks all sectors within the given rectangle as requested.

Returns true, if all the sectors are already available, false when any of them needs to be built first.

◆ RequestSector() [2/2]

bool plAiNavMesh::RequestSector ( SectorID sectorID)

Marks the sector as requested.

Returns true, if the sector is already available, false when it needs to be built first.


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