Open 3D Engine AzFramework 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.
AzPhysics::SimulatedBody Struct Referenceabstract

Base class for all Simulated bodies in Physics. More...

#include <PhysicsSimulatedBody.h>

Inherited by AzPhysics::RigidBody, AzPhysics::StaticRigidBody, Physics::Character, Physics::Ragdoll, and Physics::RagdollNode.

Public Member Functions

 AZ_RTTI (AzPhysics::SimulatedBody, "{BCC37A4F-1C05-4660-9E41-0CCF2D5E7175}")
 
template<typename T >
void SetUserData (T *userData)
 
void * GetUserData ()
 
void SetFrameId (uint32_t frameId)
 
uint32_t GetFrameId () const
 
virtual AzPhysics::SceneQueryHit RayCast (const RayCastRequest &request)=0
 
void ProcessCollisionEvent (const CollisionEvent &collision) const
 
void ProcessTriggerEvent (const TriggerEvent &trigger) const
 
void SyncTransform (float deltaTime) const
 
void RegisterOnCollisionBeginHandler (SimulatedBodyEvents::OnCollisionBegin::Handler &handler)
 
void RegisterOnCollisionPersistHandler (SimulatedBodyEvents::OnCollisionPersist::Handler &handler)
 see RegisterOnCollisionBeginHandler
 
void RegisterOnCollisionEndHandler (SimulatedBodyEvents::OnCollisionEnd::Handler &handler)
 see RegisterOnCollisionBeginHandler
 
void RegisterOnTriggerEnterHandler (SimulatedBodyEvents::OnTriggerEnter::Handler &handler)
 
void RegisterOnTriggerExitHandler (SimulatedBodyEvents::OnTriggerExit::Handler &handler)
 see RegisterOnTriggerEnterHandler
 
void RegisterOnSyncTransformHandler (SimulatedBodyEvents::OnSyncTransform::Handler &handler)
 Helper to register a handler for a SyncTransform event on this Simulated body.
 
virtual AZ::Crc32 GetNativeType () const =0
 
virtual void * GetNativePointer () const =0
 
virtual SceneGetScene ()
 
virtual AZ::EntityId GetEntityId () const =0
 
virtual AZ::Transform GetTransform () const =0
 
virtual void SetTransform (const AZ::Transform &transform)=0
 
virtual AZ::Vector3 GetPosition () const =0
 
virtual AZ::Quaternion GetOrientation () const =0
 
virtual AZ::Aabb GetAabb () const =0
 

Static Public Member Functions

static void Reflect (AZ::ReflectContext *context)
 

Public Attributes

 AZ_CLASS_ALLOCATOR_DECL
 
SceneHandle m_sceneOwner = AzPhysics::InvalidSceneHandle
 The current Scene the simulated body is contained.
 
SimulatedBodyHandle m_bodyHandle = AzPhysics::InvalidSimulatedBodyHandle
 The handle to this simulated body.
 
bool m_simulating = false
 

Static Public Attributes

static constexpr uint32_t UndefinedFrameId = AZStd::numeric_limits<uint32_t>::max()
 

Friends

class Automation::SimulatedBodyCollisionAutomationHandler
 
class Automation::SimulatedBodyTriggerAutomationHandler
 

Detailed Description

Base class for all Simulated bodies in Physics.

Member Function Documentation

◆ GetFrameId()

uint32_t AzPhysics::SimulatedBody::GetFrameId ( ) const
inline

Helper functions for getting the set frame ID.

Returns
Will return the frame ID.

◆ GetScene()

virtual Scene* AzPhysics::SimulatedBody::GetScene ( )
virtual

Helper to get the scene this body is attached too.

Returns
Returns a pointer to the scene.

◆ GetUserData()

void* AzPhysics::SimulatedBody::GetUserData ( )
inline

Helper functions for getting the set user data.

Returns
Will return a void* to the user data set.

◆ ProcessCollisionEvent()

void AzPhysics::SimulatedBody::ProcessCollisionEvent ( const CollisionEvent collision) const

Helper to direct the CollisionEvent to the correct handler. Will invoke the OnCollisionBegin or OnCollisionPersist or OnCollisionEnd event.

Parameters
collisionThe collision data to be routed.

◆ ProcessTriggerEvent()

void AzPhysics::SimulatedBody::ProcessTriggerEvent ( const TriggerEvent trigger) const

Helper to direct the TriggerEvent to the correct handler. Will invoke the OnTriggerEnter or OnTriggerExitevent event.

Parameters
triggerThe trigger data to be routed.

◆ RayCast()

virtual AzPhysics::SceneQueryHit AzPhysics::SimulatedBody::RayCast ( const RayCastRequest request)
pure virtual

Perform a ray cast on this Simulated Body.

Parameters
requestThe request to make.
Returns
Returns the closest hit, if any, against this simulated body.

◆ RegisterOnCollisionBeginHandler()

void AzPhysics::SimulatedBody::RegisterOnCollisionBeginHandler ( SimulatedBodyEvents::OnCollisionBegin::Handler &  handler)
inline

Helpers to register a handler for Collision events on this Simulated body. OnCollisionBegin is when two bodies start to collide. OnCollisionPersist is when two bodies continue to collide. OnCollisionEnd is when two bodies stop colliding.

◆ RegisterOnTriggerEnterHandler()

void AzPhysics::SimulatedBody::RegisterOnTriggerEnterHandler ( SimulatedBodyEvents::OnTriggerEnter::Handler &  handler)
inline

Helpers to register a handler for Trigger Events on this Simulated body. OnTriggerEnter is when a body enters a trigger. OnTriggerExit is when a body leaves a trigger.

◆ SetFrameId()

void AzPhysics::SimulatedBody::SetFrameId ( uint32_t  frameId)
inline

Helper functions for setting frame ID.

Parameters
frameIdOptionally set frame ID for the systems moving the actors back in time.

◆ SetUserData()

template<typename T >
void AzPhysics::SimulatedBody::SetUserData ( T *  userData)

Helper functions for setting user data.

Parameters
userDataCan be a pointer to any type as internally will be cast to a void*. Object lifetime not managed by the SimulatedBody.

◆ SyncTransform()

void AzPhysics::SimulatedBody::SyncTransform ( float  deltaTime) const

Helper to send SyncTransform event to the relevant handlers.

Parameters
deltaTimeFrame time.

Member Data Documentation

◆ m_simulating

bool AzPhysics::SimulatedBody::m_simulating = false

Flag to determine if the body is part of the simulation. When true the body will be affected by any forces, collisions, and found with scene queries.


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