Thrive
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
thrive::RigidBodyComponent Class Reference

A component for a rigid body. More...

#include <rigid_body_system.h>

Inheritance diagram for thrive::RigidBodyComponent:
thrive::Component

Classes

struct  DynamicProperties
 Dynamic properties (those the physics engine changes) More...
 
struct  Properties
 Properties. More...
 

Public Member Functions

 RigidBodyComponent (short int collisionFilterGroup=btBroadphaseProxy::DefaultFilter, short int collisionFilterMask=btBroadphaseProxy::AllFilter)
 Constructor. More...
 
void applyCentralImpulse (const Ogre::Vector3 &impulse)
 Applies an impulse to the center of mass. More...
 
void applyImpulse (const Ogre::Vector3 &impulse, const Ogre::Vector3 &relativePosition)
 Applies an impulse. More...
 
void applyTorque (const Ogre::Vector3 &torque)
 Applies a torque to the body. More...
 
void clearForces ()
 Clears forces acting upon the body.
 
void disableCollisionsWith (EntityId other)
 This disables collisions with another entity. More...
 
void reenableAllCollisions ()
 Reenables all collisions previously disabled.
 
void getWorldTransform (btTransform &transform) const override
 Reimplemented from btMotionState. More...
 
void load (const StorageContainer &storage) override
 Loads the component. More...
 
void setWorldTransform (const btTransform &transform) override
 Reimplemented from btMotionState. More...
 
void setDynamicProperties (const Ogre::Vector3 &position, const Ogre::Quaternion &orientation, const Ogre::Vector3 &linearVelocity, const Ogre::Vector3 &angularVelocity)
 Overrides the physics engine. More...
 
StorageContainer storage () const override
 Serializes the component. More...
 
- Public Member Functions inherited from thrive::Component
virtual ~Component ()=0
 Destructor.
 
bool isVolatile () const
 A volatile component is not serialized during a save. More...
 
EntityId owner () const
 The entity this component belongs to. More...
 
void setVolatile (bool isVolatile)
 Sets the volatile flag. More...
 
void setOwner (EntityId owner)
 Sets the component's owner. More...
 
virtual ComponentTypeId typeId () const =0
 The component's type id.
 
virtual std::string typeName () const =0
 The component's type name.
 

Static Public Member Functions

static luabind::scope luaBindings ()
 Lua bindings. More...
 
- Static Public Member Functions inherited from thrive::Component
static luabind::scope luaBindings ()
 Lua bindings. More...
 

Public Attributes

btRigidBody * m_body = nullptr
 Internal object, dont use this directly.
 
const short int m_collisionFilterGroup
 The body's collision group.
 
const short int m_collisionFilterMask
 The groups this body can collide with.
 
DynamicProperties m_dynamicProperties
 Dynamic properties.
 
std::list< std::pair< Ogre::Vector3, Ogre::Vector3 > > m_impulseQueue
 Queue of impulses since the last frame.
 
Ogre::Vector3 m_torque = Ogre::Vector3::ZERO
 The torque that has been applied in this timestep.
 
Properties m_properties
 Properties.
 
EntityId m_pushbackEntity = NULL_ENTITY
 
float m_pushbackAngle = 0
 

Friends

class RigidBodyInputSystem
 

Detailed Description

A component for a rigid body.

Constructor & Destructor Documentation

thrive::RigidBodyComponent::RigidBodyComponent ( short int  collisionFilterGroup = btBroadphaseProxy::DefaultFilter,
short int  collisionFilterMask = btBroadphaseProxy::AllFilter 
)
inline

Constructor.

Parameters
collisionFilterGroupThe collision group this body belongs to
collisionFilterMaskThe groups this body can collide with

Member Function Documentation

void RigidBodyComponent::applyCentralImpulse ( const Ogre::Vector3 &  impulse)

Applies an impulse to the center of mass.

Parameters
impulseThe impulse
void RigidBodyComponent::applyImpulse ( const Ogre::Vector3 &  impulse,
const Ogre::Vector3 &  relativePosition 
)

Applies an impulse.

Parameters
impulseThe impulse
relativePositionThe attack point, relative to the center of mass
void RigidBodyComponent::applyTorque ( const Ogre::Vector3 &  torque)

Applies a torque to the body.

Parameters
torqueThe torque to apply
void RigidBodyComponent::disableCollisionsWith ( EntityId  other)

This disables collisions with another entity.

Parameters
otherThe entity to nocollide with
void RigidBodyComponent::getWorldTransform ( btTransform &  transform) const
override

Reimplemented from btMotionState.

Parameters
[out]transformThe rigid body's position and orientation
void RigidBodyComponent::load ( const StorageContainer &  storage)
overridevirtual

Loads the component.

Parameters
storage

Implements thrive::Component.

luabind::scope RigidBodyComponent::luaBindings ( )
static

Lua bindings.

Exposes:

Returns
void RigidBodyComponent::setDynamicProperties ( const Ogre::Vector3 &  position,
const Ogre::Quaternion &  orientation,
const Ogre::Vector3 &  linearVelocity,
const Ogre::Vector3 &  angularVelocity 
)

Overrides the physics engine.

Warning
May introduce instabilities. Use applyImpulse() if you want to move the body.
Parameters
positionNew position
orientationNew orientation
linearVelocityNew velocity
angularVelocityNew rotation
void RigidBodyComponent::setWorldTransform ( const btTransform &  transform)
override

Reimplemented from btMotionState.

Parameters
transformThe rigid body's position and orientation
StorageContainer RigidBodyComponent::storage ( ) const
overridevirtual

Serializes the component.

Returns

Implements thrive::Component.


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