Open 3D Engine RecastNavigation Gem API Reference  24.09
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
RecastNavigation::RecastNavigationMeshComponentController Class Reference

#include <RecastNavigationMeshComponentController.h>

Inherits RecastNavigationMeshRequestBus::Handler.

Public Member Functions

 AZ_CLASS_ALLOCATOR (RecastNavigationMeshComponentController, AZ::SystemAllocator)
 
 AZ_RTTI (RecastNavigationMeshComponentController, "{D34CD5E0-8C29-4545-8734-9C7A92F03740}")
 
 RecastNavigationMeshComponentController (const RecastNavigationMeshConfig &config)
 
void Activate (const AZ::EntityComponentIdPair &entityComponentIdPair)
 
void Deactivate ()
 
void SetConfiguration (const RecastNavigationMeshConfig &config)
 
const RecastNavigationMeshConfigGetConfiguration () const
 
bool CreateNavigationMesh (AZ::EntityId meshEntityId)
 
bool AttachNavigationTileToMesh (NavigationTileData &navigationTileData)
 
NavigationTileData CreateNavigationTile (TileGeometry *geom, const RecastNavigationMeshConfig &meshConfig, rcContext *context)
 
void ReceivedAllNewTilesImpl (const RecastNavigationMeshConfig &config, AZ::ScheduledEvent &sendNotificationEvent)
 
bool UpdateNavigationMeshBlockUntilCompleted () override
 
bool UpdateNavigationMeshAsync () override
 
AZStd::shared_ptr< NavMeshQueryGetNavigationObject () override
 

Static Public Member Functions

static void Reflect (AZ::ReflectContext *context)
 
static void GetProvidedServices (AZ::ComponentDescriptor::DependencyArrayType &provided)
 
static void GetRequiredServices (AZ::ComponentDescriptor::DependencyArrayType &required)
 
static void GetIncompatibleServices (AZ::ComponentDescriptor::DependencyArrayType &incompatible)
 

Protected Member Functions

void OnSendNotificationTick ()
 
bool IsDebugDrawEnabled () const
 
void OnDebugDrawTick ()
 If debug draw was specified, then this call will be invoked every frame.
 
void OnReceivedAllNewTiles ()
 
void OnTileProcessedEvent (AZStd::shared_ptr< TileGeometry > tile)
 

Protected Attributes

AZ::EntityComponentIdPair m_entityComponentIdPair
 
RecastNavigationMeshConfig m_configuration
 In-game navigation mesh configuration.
 
AZ::ScheduledEvent m_sendNotificationEvent { [this]() { OnSendNotificationTick(); }, AZ::Name("RecastNavigationMeshUpdated") }
 
AZ::ScheduledEvent m_tickEvent { [this]() { OnDebugDrawTick(); }, AZ::Name("RecastNavigationDebugViewTick") }
 Tick event for the optional debug draw.
 
AZ::ScheduledEvent m_receivedAllNewTilesEvent { [this]() { OnReceivedAllNewTiles(); }, AZ::Name("RecastNavigationReceivedTiles") }
 
RecastNavigationDebugDraw m_customDebugDraw
 Debug draw object for Recast navigation mesh.
 
AZStd::unique_ptr< rcContext > m_context
 Recast logging functionality and other optional tools.
 
AZStd::shared_ptr< NavMeshQuerym_navObject
 Recast navigation objects.
 
AZStd::vector< AZStd::shared_ptr< TileGeometry > > m_tilesToBeProcessed
 
AZStd::recursive_mutex m_tileProcessingMutex
 
AZStd::atomic< bool > m_shouldProcessTiles { true }
 A way to check if we should stop tile processing (because we might be deactivating, for example).
 
AZ::TaskGraph m_taskGraph { "RecastNavigation Tile Processing" }
 Task graph objects to process tile geometry into Recast tiles.
 
AZ::TaskExecutor m_taskExecutor
 
AZStd::unique_ptr< AZ::TaskGraphEvent > m_taskGraphEvent
 
AZ::TaskDescriptor m_taskDescriptor { "Processing Tiles", "Recast Navigation" }
 
AZStd::atomic< bool > m_updateInProgress { false }
 If true, an update operation is in progress.
 

Friends

class EditorRecastNavigationMeshComponent
 

Detailed Description

Common navigation mesh logic for Recast navigation components. Recommended use is as a base class. The method provided are not thread-safe. Use the mutex from @m_navObject to synchronize as necessary at the higher level.

Member Function Documentation

◆ AttachNavigationTileToMesh()

bool RecastNavigation::RecastNavigationMeshComponentController::AttachNavigationTileToMesh ( NavigationTileData navigationTileData)

Given a Recast data add a tile to the navigation mesh @m_navMesh.

Parameters
navigationTileDatathe raw data of a Recast tile
Returns
true if successful.

◆ CreateNavigationMesh()

bool RecastNavigation::RecastNavigationMeshComponentController::CreateNavigationMesh ( AZ::EntityId  meshEntityId)

Allocates and initializes Recast navigation mesh into @m_navMesh.

Parameters
meshEntityIdthe entity's positions will be used as the center of the navigation mesh.
Returns
true if the navigation mesh object was successfully created.

◆ CreateNavigationTile()

NavigationTileData RecastNavigation::RecastNavigationMeshComponentController::CreateNavigationTile ( TileGeometry geom,
const RecastNavigationMeshConfig meshConfig,
rcContext *  context 
)

Given a set of geometry and configuration create a Recast tile that can be attached using @AttachNavigationTileToMesh.

Parameters
geomA set of geometry, triangle data.
meshConfigRecast navigation mesh configuration.
contextRecast context object, @rcContext.
Returns
the tile data that can be attached to the navigation mesh using @AttachNavigationTileToMesh

◆ ReceivedAllNewTilesImpl()

void RecastNavigation::RecastNavigationMeshComponentController::ReceivedAllNewTilesImpl ( const RecastNavigationMeshConfig config,
AZ::ScheduledEvent &  sendNotificationEvent 
)

Creates a task graph with tasks to process received tile data.

Parameters
confignavigation mesh configuration to apply to the tile data
sendNotificationEventonce all the tiles are processed and added to the navigation update notify on the main thread

◆ UpdateNavigationMeshBlockUntilCompleted()

bool RecastNavigation::RecastNavigationMeshComponentController::UpdateNavigationMeshBlockUntilCompleted ( )
override

RecastNavigationRequestBus overrides ...

Member Data Documentation

◆ m_receivedAllNewTilesEvent

AZ::ScheduledEvent RecastNavigation::RecastNavigationMeshComponentController::m_receivedAllNewTilesEvent { [this]() { OnReceivedAllNewTiles(); }, AZ::Name("RecastNavigationReceivedTiles") }
protected

Tick event to notify on navigation mesh updates from the main thread. This is often needed for script environment, such as Script Canvas.

◆ m_sendNotificationEvent

AZ::ScheduledEvent RecastNavigation::RecastNavigationMeshComponentController::m_sendNotificationEvent { [this]() { OnSendNotificationTick(); }, AZ::Name("RecastNavigationMeshUpdated") }
protected

Tick event to notify on navigation mesh updates from the main thread. This is often needed for script environment, such as Script Canvas.


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