Open 3D Engine PhysX 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.
PhysX::HeightfieldCollider Class Reference

#include <HeightfieldCollider.h>

Inherits AzPhysics::SimulatedBodyComponentRequestsBus::Handler, Physics::HeightfieldProviderNotificationBus::Handler, and PhysX::ColliderShapeRequestBus::Handler.

Public Types

enum class  DataSource { GenerateNewHeightfield , UseCachedHeightfield }
 Enum for specifying how Heightfield Collider should be created. More...
 

Public Member Functions

 HeightfieldCollider (AZ::EntityId entityId, const AZStd::string &entityName, AzPhysics::SceneHandle sceneHandle, AZStd::shared_ptr< Physics::ColliderConfiguration > colliderConfig, AZStd::shared_ptr< Physics::HeightfieldShapeConfiguration > shapeConfig, DataSource dataSourceType)
 
AZStd::shared_ptr< Physics::Shape > GetHeightfieldShape ()
 
void RefreshHeightfield (Physics::HeightfieldProviderNotifications::HeightfieldChangeMask changeMask, const AZ::Aabb &dirtyRegion=AZ::Aabb::CreateNull())
 
const AzPhysics::SimulatedBody * GetSimulatedBody () const
 
void BlockOnPendingJobs ()
 
void EnablePhysics () override
 
void DisablePhysics () override
 
bool IsPhysicsEnabled () const override
 
AZ::Aabb GetAabb () const override
 
AzPhysics::SimulatedBody * GetSimulatedBody () override
 
AzPhysics::SimulatedBodyHandle GetSimulatedBodyHandle () const override
 
AzPhysics::SceneQueryHit RayCast (const AzPhysics::RayCastRequest &request) override
 

Protected Member Functions

void OnHeightfieldDataChanged (const AZ::Aabb &dirtyRegion, Physics::HeightfieldProviderNotifications::HeightfieldChangeMask changeMask) override
 
AZ::Aabb GetColliderShapeAabb () override
 
bool IsTrigger () override
 
void ClearHeightfield ()
 
void InitStaticRigidBody (const AZ::Transform &baseTransform)
 
void InitStaticRigidBody ()
 
void UpdateHeightfieldMaterialSlots (const Physics::MaterialSlots &updatedMaterialSlots)
 

Detailed Description

PhysX Heightfield Collider base class. This contains all the logic shared between the Editor Heightfield Collider Component and the Heightfield Collider Component to create, update, and destroy the heightfield collider at runtime.

Member Enumeration Documentation

◆ DataSource

Enum for specifying how Heightfield Collider should be created.

Enumerator
GenerateNewHeightfield 

Generate a new heightfield using the data from the Terrain System.

UseCachedHeightfield 

Use the cached heightfield data from shape configuration. Usually it comes loaded from a heightfield asset.

Constructor & Destructor Documentation

◆ HeightfieldCollider()

PhysX::HeightfieldCollider::HeightfieldCollider ( AZ::EntityId  entityId,
const AZStd::string &  entityName,
AzPhysics::SceneHandle  sceneHandle,
AZStd::shared_ptr< Physics::ColliderConfiguration >  colliderConfig,
AZStd::shared_ptr< Physics::HeightfieldShapeConfiguration >  shapeConfig,
DataSource  dataSourceType 
)

Create a HeightfieldCollider that operates on the given set of data.

Parameters
entityIdThe entity Id for the entity that contains this heightfield collider
entityNameThe enntity name for the entity that contains this heightfield collider (for debug purposes)
sceneHandlerThe physics scene to create the collider in (Editor or runtime)
colliderConfigThe collider configuration to use. Some of its data will get modified based on the heightfield data.
shapeConfigThe shape configuration to use. All of its data will get modified based on the heightfield data.

Member Function Documentation

◆ GetHeightfieldShape()

AZStd::shared_ptr<Physics::Shape> PhysX::HeightfieldCollider::GetHeightfieldShape ( )

Get the currently-spawned heightfield shape.

Returns
Pointer to the heightfield shape.

◆ GetSimulatedBody()

const AzPhysics::SimulatedBody* PhysX::HeightfieldCollider::GetSimulatedBody ( ) const

Get a pointer to the currently-spawned simulated body.

Returns
Pointer to the simulated body.

◆ RefreshHeightfield()

void PhysX::HeightfieldCollider::RefreshHeightfield ( Physics::HeightfieldProviderNotifications::HeightfieldChangeMask  changeMask,
const AZ::Aabb &  dirtyRegion = AZ::Aabb::CreateNull() 
)

Notify the heightfield that it may need to refresh some or all of its data.

Parameters
changeMaskThe types of data changes causing the notification.
dirtyRegionThe area affected by the notification, or a Null Aabb if everything is affected.

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