GUInity
Public Member Functions | List of all members
RigidBody Class Reference

#include <RigidBody.hpp>

Inheritance diagram for RigidBody:
Subject< RigidBody > Component

Public Member Functions

 RigidBody ()
 
virtual ~RigidBody ()
 
virtual void init () override
 
virtual void destroy () override
 
virtual void tick (float deltaSecods) override
 
virtual void setActive (bool isActive) override
 
PxRigidBody * getRigidbody ()
 
void setKinematic (bool isKinematic)
 
bool getKinematic ()
 
void setGravity (bool enabled)
 
bool getGravity ()
 
void setConstraintsFlags (int constraintFlags)
 
int getConstraintsFlags ()
 
void updateTransform (const PxTransform &transform)
 
void addForce (glm::vec3 force)
 
virtual shared_ptr< Componentclone () override
 
virtual shared_ptr< ComponentDescriptiongetComponentDescription () override
 
virtual void deserialize (shared_ptr< ComponentDescription > desc) override
 
- Public Member Functions inherited from Component
 Component ()
 
virtual ~Component ()
 
virtual void awake ()
 
shared_ptr< ActorgetActor ()
 
void setActor (weak_ptr< Actor > actor)
 

Additional Inherited Members

- Static Public Member Functions inherited from Subject< RigidBody >
static void addObserver (shared_ptr< Observer > observer)
 
static void removeObserver (shared_ptr< Observer > observer)
 
- Protected Member Functions inherited from Component
void setCopyMode (bool initWithData)
 
- Static Protected Member Functions inherited from Subject< RigidBody >
static void notify (ComponentEventType type, shared_ptr< Component > component, bool isEditor)
 
static void notify (ActorEventType type, shared_ptr< Actor > actor, bool isEditor)
 
- Protected Attributes inherited from Component
bool initWithData
 
bool isActive
 

Detailed Description

RigidBody is the component that adds real physics simulation to an Actor. It's dynamic and directly influences in the Transform of the Actor due to physics simulation

Constructor & Destructor Documentation

RigidBody::RigidBody ( )

Default Constructor

RigidBody::~RigidBody ( )
virtual

Default Destructor

Member Function Documentation

void RigidBody::addForce ( glm::vec3  axis)

Add force to the RigidBody

Parameters
[in]theforce that will be added (direction and magnitude)
shared_ptr< Component > RigidBody::clone ( )
overridevirtual

Clones current component (Prototype Design Pattern)

Returns
shared_ptr to cloned RigidBody Component

Implements Component.

void RigidBody::destroy ( )
overridevirtual

Component destroy override. Releases the RigidDynamic body

Reimplemented from Component.

int RigidBody::getConstraintsFlags ( )

Set the translation/rotation constraints of the rigidbody.

Returns
current constraints of the rigidbody s
bool RigidBody::getGravity ( )

gravity getter

Returns
true if gravity is enabled, false otherwise
bool RigidBody::getKinematic ( )

isKinematic getter

Returns
true if physics is being simulated, false if it's not
PxRigidBody * RigidBody::getRigidbody ( )

physxRigidBody getter

Returns
pointer to PhysX RigidBody
void RigidBody::init ( )
overridevirtual

Component init override. Creates a RigidDynamic body in the PhysX scene

Reimplemented from Component.

void RigidBody::setActive ( bool  isActive)
overridevirtual

Component setActive override. Disables visualization and physics simulation in the PhysX scene

Reimplemented from Component.

void RigidBody::setConstraintsFlags ( int  constraintFlags)

Set the translation/rotation constraints of the rigidbody.

Parameters
[in]flagsto constrain
void RigidBody::setGravity ( bool  enabled)

gravity setter

Parameters
[in]enabledtrue if gravity is enabled, false otherwise
void RigidBody::setKinematic ( bool  isKinematic)

isKinematic setter

Parameters
trueif physics should be not be simulated, false if it should
void RigidBody::tick ( float  deltaSeconds)
overridevirtual

Component tick override. Updates the PhysX scene with the Actor transform

Parameters
[in]deltaSecondslast frame duration

Component tick override. Updates the PhysX scene with the Actor transform

Reimplemented from Component.

void RigidBody::updateTransform ( const PxTransform &  newTransform)

Update the transform based on the PhysX physics simulation and current constraints

Parameters
[in]thePhysX transform

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