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

#include <RecastNavigationPhysXProviderComponentController.h>

Inherits RecastNavigationProviderRequestBus::Handler.

Public Types

using QueryHits = AZStd::vector< AzPhysics::SceneQueryHit >
 A container of PhysX overlap scene hits (has PhysX colliders and their position/orientation).
 

Public Member Functions

 AZ_CLASS_ALLOCATOR (RecastNavigationPhysXProviderComponentController, AZ::SystemAllocator)
 
 AZ_RTTI (RecastNavigationPhysXProviderComponentController, "{182D93F8-9E76-409B-9939-6816509A6F52}")
 
 RecastNavigationPhysXProviderComponentController (const RecastNavigationPhysXProviderConfig &config)
 
void Activate (const AZ::EntityComponentIdPair &entityComponentIdPair)
 
void Deactivate ()
 
void SetConfiguration (const RecastNavigationPhysXProviderConfig &config)
 
const RecastNavigationPhysXProviderConfigGetConfiguration () const
 
AZStd::vector< AZStd::shared_ptr< TileGeometry > > CollectGeometryImpl (float tileSize, float borderSize, const AZ::Aabb &worldVolume)
 
bool CollectGeometryAsyncImpl (float tileSize, float borderSize, const AZ::Aabb &worldVolume, AZStd::function< void(AZStd::shared_ptr< TileGeometry >)> tileCallback)
 
void CollectCollidersWithinVolume (const AZ::Aabb &volume, QueryHits &overlapHits)
 
void AppendColliderGeometry (TileGeometry &geometry, const QueryHits &overlapHits)
 
const char * GetSceneName () const
 Returns the built-in names for the PhysX scene, either Editor or game scene.
 
AZStd::vector< AZStd::shared_ptr< TileGeometry > > CollectGeometry (float tileSize, float borderSize) override
 
bool CollectGeometryAsync (float tileSize, float borderSize, AZStd::function< void(AZStd::shared_ptr< TileGeometry >)> tileCallback) override
 
AZ::Aabb GetWorldBounds () const override
 
int GetNumberOfTiles (float tileSize) const override
 

Static Public Member Functions

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

Protected Member Functions

void OnConfigurationChanged ()
 

Protected Attributes

AZ::EntityComponentIdPair m_entityComponentIdPair
 
RecastNavigationPhysXProviderConfig m_config
 
AzPhysics::CollisionGroup m_collisionGroup
 
AZStd::atomic< bool > m_shouldProcessTiles { true }
 A way to check if we should stop tile processing (because we might be deactivating, for example).
 
AZStd::atomic< bool > m_updateInProgress { false }
 If true, an update operation is in progress.
 
AZ::TaskGraph m_taskGraph { "RecastNavigation PhysX" }
 Task graph objects to collect geometry data in tiles over a grid.
 
AZ::TaskExecutor m_taskExecutor
 
AZStd::unique_ptr< AZ::TaskGraphEvent > m_taskGraphEvent
 
AZ::TaskDescriptor m_taskDescriptor { "Collect Geometry", "Recast Navigation" }
 

Friends

class EditorRecastNavigationPhysXProviderComponent
 

Detailed Description

Common logic for Recast navigation tiled collector components. Recommended use is as a base class. The method provided are not thread-safe. Synchronize as necessary at the higher level.

Member Function Documentation

◆ AppendColliderGeometry()

void RecastNavigation::RecastNavigationPhysXProviderComponentController::AppendColliderGeometry ( TileGeometry geometry,
const QueryHits overlapHits 
)

Given a container of static colliders return indexed triangle data.

Parameters
geometry(out) triangle data will be added
overlapHits(in) an array of static PhysX colliders

◆ CollectCollidersWithinVolume()

void RecastNavigation::RecastNavigationPhysXProviderComponentController::CollectCollidersWithinVolume ( const AZ::Aabb &  volume,
QueryHits overlapHits 
)

Finds all the static PhysX colliders within a given volume.

Parameters
volumethe world to look for static colliders
overlapHits(out) found colliders will be attached to this container

◆ CollectGeometry()

AZStd::vector< AZStd::shared_ptr< TileGeometry > > RecastNavigation::RecastNavigationPhysXProviderComponentController::CollectGeometry ( float  tileSize,
float  borderSize 
)
override

RecastNavigationProviderRequestBus overrides ...

◆ CollectGeometryAsyncImpl()

bool RecastNavigation::RecastNavigationPhysXProviderComponentController::CollectGeometryAsyncImpl ( float  tileSize,
float  borderSize,
const AZ::Aabb &  worldVolume,
AZStd::function< void(AZStd::shared_ptr< TileGeometry >)>  tileCallback 
)

Async variant of @CollectGeometryImpl. Tiles are returned via a callback @tileCallback. Calls on @tileCallback will come from a task graph (not a main thread). Is expected that the context for callback function will persist until all the tiles are processed.

Note: the callback will be called at least once and one time for each tile geometry. For example if two tiles are found the following callbacks will be made: tileCallback(tile1); tileCallback(tile2); tileCallback({}); //– this indicates the end of the operation

Parameters
tileSizethe result is packaged in tiles, which are squares covering the provided volume of @worldVolume
borderSizean additional extend in all direction around the tile volume, this additional geometry will allow Recast to connect tiles together
worldVolumeworldVolume the overall volume to collect static PhysX geometry
tileCallbackan empty tile indicates the end of the operation, otherwise a valid shared_ptr is returned with tile geometry
Returns
true if an async operation was scheduled, false otherwise

◆ CollectGeometryImpl()

AZStd::vector< AZStd::shared_ptr< TileGeometry > > RecastNavigation::RecastNavigationPhysXProviderComponentController::CollectGeometryImpl ( float  tileSize,
float  borderSize,
const AZ::Aabb &  worldVolume 
)

Blocking call. Collects all the relevant PhysX geometry within a provided volume.

Parameters
tileSizethe result is packaged in tiles, which are squares covering the provided volume of @worldVolume
borderSizean additional extend in all direction around the tile volume, this additional geometry will allow Recast to connect tiles together.
worldVolumethe overall volume to collect static PhysX geometry
Returns
an array of tiles, each containing indexed geometry

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