Overload  1.1
Game engine with editor
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
OvPhysics::Entities::PhysicalObject Class Referenceabstract

#include <PhysicalObject.h>

Inheritance diagram for OvPhysics::Entities::PhysicalObject:
OvPhysics::Entities::PhysicalBox OvPhysics::Entities::PhysicalCapsule OvPhysics::Entities::PhysicalSphere

Public Types

enum  ECollisionDetectionMode { ECollisionDetectionMode::DISCRETE, ECollisionDetectionMode::CONTINUOUS }
 
enum  EActivationState {
  EActivationState::ACTIVE = 1, EActivationState::SLEEPING = 2, EActivationState::LOOKING_FOR_SLEEP = 3, EActivationState::ALWAYS_ACTIVE = 4,
  EActivationState::ALWAYS_SLEEPING = 5
}
 

Public Member Functions

 PhysicalObject ()
 
 PhysicalObject (OvMaths::FTransform &p_transform)
 
 ~PhysicalObject ()
 
void AddForce (const OvMaths::FVector3 &p_force)
 
void AddImpulse (const OvMaths::FVector3 &p_impulse)
 
void ClearForces ()
 
void AddFlag (btCollisionObject::CollisionFlags p_flag)
 
void RemoveFlag (btCollisionObject::CollisionFlags p_flag)
 
float GetMass () const
 
const ECollisionDetectionModeGetCollisionDetectionMode () const
 
float GetBounciness () const
 
float GetFriction () const
 
OvMaths::FVector3 GetLinearVelocity () const
 
OvMaths::FVector3 GetAngularVelocity () const
 
OvMaths::FVector3 GetLinearFactor () const
 
OvMaths::FVector3 GetAngularFactor () const
 
bool IsTrigger () const
 
bool IsKinematic () const
 
EActivationState GetActivationState () const
 
OvMaths::FTransformGetTransform ()
 
void SetMass (float p_mass)
 
void SetCollisionDetectionMode (ECollisionDetectionMode p_mode)
 
void SetBounciness (float p_bounciness)
 
void SetFriction (float p_friction)
 
void SetLinearVelocity (const OvMaths::FVector3 &p_linearVelocity)
 
void SetAngularVelocity (const OvMaths::FVector3 &p_angularVelocity)
 
void SetLinearFactor (const OvMaths::FVector3 &p_linearFactor)
 
void SetAngularFactor (const OvMaths::FVector3 &p_angularFactor)
 
void SetTrigger (bool p_trigger)
 
void SetKinematic (bool p_kinematic)
 
void SetActivationState (EActivationState p_activationState)
 
void SetEnabled (bool p_enabled)
 
bool IsEnabled () const
 
template<typename T >
GetUserData () const
 
template<typename T >
void SetUserData (T p_data)
 

Public Attributes

OvTools::Eventing::Event< PhysicalObject & > CollisionStartEvent
 
OvTools::Eventing::Event< PhysicalObject & > CollisionStayEvent
 
OvTools::Eventing::Event< PhysicalObject & > CollisionStopEvent
 
OvTools::Eventing::Event< PhysicalObject & > TriggerStartEvent
 
OvTools::Eventing::Event< PhysicalObject & > TriggerStayEvent
 
OvTools::Eventing::Event< PhysicalObject & > TriggerStopEvent
 

Protected Member Functions

void Init ()
 
void RecreateBody ()
 
void ApplyInertia ()
 
virtual void SetLocalScaling (const OvMaths::FVector3 &p_scaling)=0
 
void Consider ()
 
void Unconsider ()
 

Protected Attributes

std::unique_ptr< btCollisionShape > m_shape
 

Friends

class OvPhysics::Core::PhysicsEngine
 

Detailed Description

Base class for any entity that is physical

Member Enumeration Documentation

◆ EActivationState

Defines some activation states that a physical object can have

Enumerator
ACTIVE 
SLEEPING 
LOOKING_FOR_SLEEP 
ALWAYS_ACTIVE 
ALWAYS_SLEEPING 

◆ ECollisionDetectionMode

Defines some collision detection modes that a physical object can have

Enumerator
DISCRETE 
CONTINUOUS 

Constructor & Destructor Documentation

◆ PhysicalObject() [1/2]

OvPhysics::Entities::PhysicalObject::PhysicalObject ( )

PhysicalObject constructor (Internal transform management)

◆ PhysicalObject() [2/2]

OvPhysics::Entities::PhysicalObject::PhysicalObject ( OvMaths::FTransform p_transform)

PhysicalObject constructor (External transform management)

Parameters
p_shapeType
p_transform

◆ ~PhysicalObject()

OvPhysics::Entities::PhysicalObject::~PhysicalObject ( )

PhysicalObject destructor (Free memory if the transform is internally managed)

Member Function Documentation

◆ AddFlag()

void OvPhysics::Entities::PhysicalObject::AddFlag ( btCollisionObject::CollisionFlags  p_flag)

Add a flag to the physical object

Parameters
p_flag

◆ AddForce()

void OvPhysics::Entities::PhysicalObject::AddForce ( const OvMaths::FVector3 p_force)

Add a force to the physical object

Parameters
p_force

◆ AddImpulse()

void OvPhysics::Entities::PhysicalObject::AddImpulse ( const OvMaths::FVector3 p_impulse)

Add an impulse to the physical object

Parameters
p_impulse

◆ ApplyInertia()

void OvPhysics::Entities::PhysicalObject::ApplyInertia ( )
protected

◆ ClearForces()

void OvPhysics::Entities::PhysicalObject::ClearForces ( )

Clear forces

◆ Consider()

void OvPhysics::Entities::PhysicalObject::Consider ( )
protected

◆ GetActivationState()

OvPhysics::Entities::PhysicalObject::EActivationState OvPhysics::Entities::PhysicalObject::GetActivationState ( ) const

Returns the current activation state

◆ GetAngularFactor()

OvMaths::FVector3 OvPhysics::Entities::PhysicalObject::GetAngularFactor ( ) const

Returns the angular factor of the physical object

◆ GetAngularVelocity()

OvMaths::FVector3 OvPhysics::Entities::PhysicalObject::GetAngularVelocity ( ) const

Returns the angular of the physical object

◆ GetBounciness()

float OvPhysics::Entities::PhysicalObject::GetBounciness ( ) const

Returns the bounciness of the physical object

◆ GetCollisionDetectionMode()

const OvPhysics::Entities::PhysicalObject::ECollisionDetectionMode & OvPhysics::Entities::PhysicalObject::GetCollisionDetectionMode ( ) const

Returns the collision detection mode of the physical object

◆ GetFriction()

float OvPhysics::Entities::PhysicalObject::GetFriction ( ) const

Returns the friction of the physical object

◆ GetLinearFactor()

OvMaths::FVector3 OvPhysics::Entities::PhysicalObject::GetLinearFactor ( ) const

Returns the linear factor of the physical object

◆ GetLinearVelocity()

OvMaths::FVector3 OvPhysics::Entities::PhysicalObject::GetLinearVelocity ( ) const

Returns the linear velocity of the physical object

◆ GetMass()

float OvPhysics::Entities::PhysicalObject::GetMass ( ) const

Returns the mass of the physical object

◆ GetTransform()

OvMaths::FTransform & OvPhysics::Entities::PhysicalObject::GetTransform ( )

Returns a reference to the transform of the physical object

◆ GetUserData()

template<typename T >
T OvPhysics::Entities::PhysicalObject::GetUserData ( ) const
inline

Returns the user data associated to this physical object instance

◆ Init()

void OvPhysics::Entities::PhysicalObject::Init ( )
protected

◆ IsEnabled()

bool OvPhysics::Entities::PhysicalObject::IsEnabled ( ) const

Returns true if the physical object is enabled

◆ IsKinematic()

bool OvPhysics::Entities::PhysicalObject::IsKinematic ( ) const

Returns true if the physical object is kinematic

◆ IsTrigger()

bool OvPhysics::Entities::PhysicalObject::IsTrigger ( ) const

Returns true if the physical object is a trigger

◆ RecreateBody()

void OvPhysics::Entities::PhysicalObject::RecreateBody ( )
protected

◆ RemoveFlag()

void OvPhysics::Entities::PhysicalObject::RemoveFlag ( btCollisionObject::CollisionFlags  p_flag)

Add a flag from the physical object

Parameters
p_flag

◆ SetActivationState()

void OvPhysics::Entities::PhysicalObject::SetActivationState ( EActivationState  p_activationState)

Defines the new activation state for the physical object

Parameters
p_activationState

◆ SetAngularFactor()

void OvPhysics::Entities::PhysicalObject::SetAngularFactor ( const OvMaths::FVector3 p_angularFactor)

Defines a new angular factor for the physical object

Parameters
p_angularFactor

◆ SetAngularVelocity()

void OvPhysics::Entities::PhysicalObject::SetAngularVelocity ( const OvMaths::FVector3 p_angularVelocity)

Defines a new angular velocity for the physical object

Parameters
p_angularVelocity

◆ SetBounciness()

void OvPhysics::Entities::PhysicalObject::SetBounciness ( float  p_bounciness)

Defines a new bounciness for the physical object

Parameters
p_bounciness

◆ SetCollisionDetectionMode()

void OvPhysics::Entities::PhysicalObject::SetCollisionDetectionMode ( ECollisionDetectionMode  p_mode)

Defines a new collision detection mode for the physical object

Parameters
p_mode

◆ SetEnabled()

void OvPhysics::Entities::PhysicalObject::SetEnabled ( bool  p_enabled)

Defines if the physical object should be enabled or not

Parameters
p_enabled

◆ SetFriction()

void OvPhysics::Entities::PhysicalObject::SetFriction ( float  p_friction)

Defines a new friction for the physical object

Parameters
p_mass

◆ SetKinematic()

void OvPhysics::Entities::PhysicalObject::SetKinematic ( bool  p_kinematic)

Defines if the physical object should be kinematic or not

Parameters
p_kinematic

◆ SetLinearFactor()

void OvPhysics::Entities::PhysicalObject::SetLinearFactor ( const OvMaths::FVector3 p_linearFactor)

Defines a new linear factor for the physical object

Parameters
p_linearFactor

◆ SetLinearVelocity()

void OvPhysics::Entities::PhysicalObject::SetLinearVelocity ( const OvMaths::FVector3 p_linearVelocity)

Defines a new linear velocity for the physical object

Parameters
p_linearVelocity

◆ SetLocalScaling()

virtual void OvPhysics::Entities::PhysicalObject::SetLocalScaling ( const OvMaths::FVector3 p_scaling)
protectedpure virtual

◆ SetMass()

void OvPhysics::Entities::PhysicalObject::SetMass ( float  p_mass)

Defines a new mass for the physical object

Parameters
p_mass

◆ SetTrigger()

void OvPhysics::Entities::PhysicalObject::SetTrigger ( bool  p_trigger)

Defines if the physical object should be a trigger or not

Parameters
p_trigger

◆ SetUserData()

template<typename T >
void OvPhysics::Entities::PhysicalObject::SetUserData ( p_data)
inline

Defines the user data associated to this physical object instance

Parameters
p_data

◆ Unconsider()

void OvPhysics::Entities::PhysicalObject::Unconsider ( )
protected

Friends And Related Function Documentation

◆ OvPhysics::Core::PhysicsEngine

friend class OvPhysics::Core::PhysicsEngine
friend

Member Data Documentation

◆ CollisionStartEvent

OvTools::Eventing::Event<PhysicalObject&> OvPhysics::Entities::PhysicalObject::CollisionStartEvent

◆ CollisionStayEvent

OvTools::Eventing::Event<PhysicalObject&> OvPhysics::Entities::PhysicalObject::CollisionStayEvent

◆ CollisionStopEvent

OvTools::Eventing::Event<PhysicalObject&> OvPhysics::Entities::PhysicalObject::CollisionStopEvent

◆ m_shape

std::unique_ptr<btCollisionShape> OvPhysics::Entities::PhysicalObject::m_shape
protected

◆ TriggerStartEvent

OvTools::Eventing::Event<PhysicalObject&> OvPhysics::Entities::PhysicalObject::TriggerStartEvent

◆ TriggerStayEvent

OvTools::Eventing::Event<PhysicalObject&> OvPhysics::Entities::PhysicalObject::TriggerStayEvent

◆ TriggerStopEvent

OvTools::Eventing::Event<PhysicalObject&> OvPhysics::Entities::PhysicalObject::TriggerStopEvent

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