ezEngine  Release 25.03
ezAiNavMesh Class Referencefinal

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

#include <NavMesh.h>

Public Types

using SectorID = ezUInt32
 

Public Member Functions

 ezAiNavMesh (const ezAiNavmeshConfig &navmeshConfig)
 
ezVec2I32 CalculateSectorCoord (float fPositionX, float fPositionY) const
 
ezVec2 GetSectorPositionOffset (ezVec2I32 vCoord) const
 
ezBoundingBox GetSectorBounds (ezVec2I32 vCoord, float fMinZ=0.0f, float fMaxZ=1.0f) const
 
float GetSectorSize () const
 
SectorID CalculateSectorID (ezVec2I32 vCoord) const
 
ezVec2I32 CalculateSectorCoord (SectorID sectorID) const
 
const ezAiNavMeshSectorGetSector (SectorID sectorID) const
 
bool RequestSector (SectorID sectorID)
 Marks the sector as requested. More...
 
bool RequestSector (const ezVec2 &vCenter, const ezVec2 &vHalfExtents)
 Marks all sectors within the given rectangle as requested. More...
 
void InvalidateSector (SectorID sectorID, bool bRebuildAsSoonAsPossible)
 Marks the sector as invalidated. More...
 
void InvalidateSector (const ezVec2 &vCenter, const ezVec2 &vHalfExtents, bool bRebuildAsSoonAsPossible)
 Marks all sectors within the given rectangle as invalidated. More...
 
void FinalizeSectorUpdates ()
 
SectorID RetrieveRequestedSector ()
 
void BuildSector (SectorID sectorID, const ezNavmeshGeoWorldModuleInterface *pGeo)
 
const dtNavMesh * GetDetourNavMesh () const
 
void DebugDraw (ezDebugRendererContext context, const ezAiNavigationConfig &config)
 
const ezAiNavmeshConfigGetConfig () 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 ezAiNavMeshWorldModule.

To do a path search, use ezAiNavigation. 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 ezAiNavMesh::InvalidateSector ( const ezVec2 vCenter,
const ezVec2 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 ezAiNavMesh::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 ezAiNavMesh::RequestSector ( const ezVec2 vCenter,
const ezVec2 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 ezAiNavMesh::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: