Open 3D Engine AzFramework 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.
Physics::Character Class Referenceabstract

#include <Character.h>

Inherits AzPhysics::SimulatedBody.

Public Member Functions

 AZ_CLASS_ALLOCATOR (Character, AZ::SystemAllocator)
 
 AZ_RTTI (Physics::Character, "{962E37A1-3401-4672-B896-0A6157CFAC97}", AzPhysics::SimulatedBody)
 
virtual AZ::Vector3 GetBasePosition () const =0
 
virtual void SetBasePosition (const AZ::Vector3 &position)=0
 
virtual void SetRotation (const AZ::Quaternion &rotation)=0
 
virtual AZ::Vector3 GetCenterPosition () const =0
 
virtual float GetStepHeight () const =0
 
virtual void SetStepHeight (float stepHeight)=0
 
virtual AZ::Vector3 GetUpDirection () const =0
 
virtual void SetUpDirection (const AZ::Vector3 &upDirection)=0
 
virtual float GetSlopeLimitDegrees () const =0
 
virtual void SetSlopeLimitDegrees (float slopeLimitDegrees)=0
 
virtual float GetMaximumSpeed () const =0
 
virtual void SetMaximumSpeed (float maximumSpeed)=0
 
virtual AZ::Vector3 GetVelocity () const =0
 
virtual void SetCollisionLayer (const AzPhysics::CollisionLayer &layer)=0
 
virtual void SetCollisionGroup (const AzPhysics::CollisionGroup &group)=0
 
virtual AzPhysics::CollisionLayer GetCollisionLayer () const =0
 
virtual AzPhysics::CollisionGroup GetCollisionGroup () const =0
 
virtual AZ::Crc32 GetColliderTag () const =0
 
virtual void AddVelocity (const AZ::Vector3 &velocity)
 
virtual void AddVelocityForTick (const AZ::Vector3 &velocity)=0
 
virtual void AddVelocityForPhysicsTimestep (const AZ::Vector3 &velocity)=0
 
virtual void ApplyRequestedVelocity (float deltaTime)=0
 
virtual void ResetRequestedVelocityForTick ()=0
 
virtual void ResetRequestedVelocityForPhysicsTimestep ()=0
 
virtual void Move (const AZ::Vector3 &requestedMovement, float deltaTime)=0
 
virtual void AttachShape (AZStd::shared_ptr< Physics::Shape > shape)=0
 
- Public Member Functions inherited from AzPhysics::SimulatedBody
 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
 

Additional Inherited Members

- Static Public Member Functions inherited from AzPhysics::SimulatedBody
static void Reflect (AZ::ReflectContext *context)
 
- Public Attributes inherited from AzPhysics::SimulatedBody
 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 inherited from AzPhysics::SimulatedBody
static constexpr uint32_t UndefinedFrameId = AZStd::numeric_limits<uint32_t>::max()
 

Detailed Description

Basic implementation of common character-style needs as a WorldBody. Is not a full-functional ship-ready all-purpose character controller implementation. This class just abstracts some common functionality amongst typical characters, and is take-it-or-leave it style; useful as a starting point or reference.

Member Function Documentation

◆ AddVelocityForPhysicsTimestep()

virtual void Physics::Character::AddVelocityForPhysicsTimestep ( const AZ::Vector3 &  velocity)
pure virtual

Queues up a request to apply a velocity to the character, lasting for the duration of the physics timestep. All requests received are accumulated (so for example, the effects of animation and gravity can be applied in two separate requests), and the accumulated velocity is used when the character updates. Velocities added this way will apply until the end of the physics timestep. Obstacles and the maximum speed setting may prevent the actual movement from exactly matching the requested movement.

Parameters
velocityThe velocity to be added to the accumulated requests, lasting for the duration of a physics timestep.

◆ AddVelocityForTick()

virtual void Physics::Character::AddVelocityForTick ( const AZ::Vector3 &  velocity)
pure virtual

Queues up a request to apply a velocity to the character, lasting for the duration of the tick. All requests received are accumulated (so for example, the effects of animation and gravity can be applied in two separate requests), and the accumulated velocity is used when the character updates. Velocities added this way will apply until the end of the tick. Obstacles and the maximum speed setting may prevent the actual movement from exactly matching the requested movement.

Parameters
velocityThe velocity to be added to the accumulated requests, lasting for the duration of the tick.

◆ ApplyRequestedVelocity()

virtual void Physics::Character::ApplyRequestedVelocity ( float  deltaTime)
pure virtual

Applies the queued velocity requests. The expected usage is for this function to be called internally by the physics system, so that the cumulative result of multiple movement effects (e.g. animation, gravity, pseudo-impulses etc) can be combined from separate calls to AddVelocityForTick or AddVelocityForPhysicsTimestep. Accumulating the requests avoids performing multiple expensive character updates, and avoids any effects from the order of requests within a tick. Users who wish to add a new movement effect should generally just be able to use AddVelocityForTick or AddVelocityForPhysicsTimestep, and rely on the existing physics system call to ApplyRequestedVelocity.

Parameters
deltaTimeThe duration over which to apply the accumulated requested velocity.

◆ Move()

virtual void Physics::Character::Move ( const AZ::Vector3 &  requestedMovement,
float  deltaTime 
)
pure virtual

Directly requests the character to move. Used for making an immediate, displacement-based movement request, as opposed to a queued, velocity-based request. Obstacles may prevent the actual movement from exactly matching the requested movement. @ param requestedMovement The desired displacement relative to the character's current position. @ param deltaTime The duration over which to apply the requested movement.

◆ ResetRequestedVelocityForPhysicsTimestep()

virtual void Physics::Character::ResetRequestedVelocityForPhysicsTimestep ( )
pure virtual

Sets the accumulated velocity requests which last for the duration of a physics timestep to zero. The expected usage is for this funciton to be called internally by the physics system, to flush per timestep velocity requests once per timestep. Velocity requests with duration of the tick are not affected.

◆ ResetRequestedVelocityForTick()

virtual void Physics::Character::ResetRequestedVelocityForTick ( )
pure virtual

Sets the accumulated velocity requests which last for the duration of a tick to zero. The expected usage is for this funciton to be called internally by the physics system, to flush per tick velocity requests once per tick. Velocity requests with duration of the physics timestep are not affected.


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