Wasabi
Public Member Functions | List of all members
WRigidBody Class Referenceabstract

#include <WRigidBody.hpp>

Inheritance diagram for WRigidBody:
WBase WOrientation WBulletRigidBody

Public Member Functions

 WRigidBody (class Wasabi *const app, uint32_t ID=0)
 
WError BuildFromGeometries (W_RIGIDBODYTYPE type, class WGeometry *const *geometries, uint32_t numGeometries, bool bFixed=false, bool bSimplify=true, void *mopp=nullptr, uint32_t moppsize=0)
 
void Destroy ()
 
void BindObject (class WObject *const object)
 
void UnbindObject (class WObject *const object)
 
void UnbindObject (uint32_t ID)
 
void Enable ()
 
void Disable ()
 
bool Enabled () const
 
void SetLinearVelocity (float velX, float velY, float velZ)
 
void SetAngularVelocity (float velX, float velY, float velZ)
 
void SetLinearDamping (float power)
 
void SetAngularDamping (float power)
 
void SetMaxLinearVelocity (float fScalarVelocity)
 
void SetMaxAngularVelocity (float fScalarVelocity)
 
void SetMotionType (W_MOTIONTYPE type)
 
void SetBouncingPower (float bouncing)
 
void SetMass (float mass)
 
void SetMassCenter (float x, float y, float z)
 
void SetFriction (float friction)
 
void SetCollisionQuality (W_COLLISIONQUALITY quality)
 
void UpdateLocals ()
 
WMatrix GetWorldMatrix ()
 
hkQuaternion GetRotationQuat ()
 
W_RIGIDBODYTYPE GetType () const
 
hkpRigidBody * GetRigidBody () const
 
bool Valid () const
 
void OnStateChange (STATE_CHANGE_TYPE type)
 
 WRigidBody (class Wasabi *const app, uint32_t ID=0)
 
virtual WError Create (W_RIGID_BODY_CREATE_INFO createInfo, bool bSaveInfo=false)=0
 
virtual void Update (float deltaTime)=0
 
virtual void BindObject (WOrientation *obj, WBase *objBase=nullptr)=0
 
virtual void SetLinearVelocity (WVector3 vel)=0
 
virtual void SetAngularVelocity (WVector3 vel)=0
 
virtual void SetLinearDamping (float power)=0
 
virtual void SetAngularDamping (float power)=0
 
virtual void SetBouncingPower (float bouncing)=0
 
virtual void SetMass (float mass)=0
 
virtual void SetMassCenter (float x, float y, float z)=0
 
virtual void SetFriction (float friction)=0
 
virtual void ApplyForce (WVector3 force)=0
 
virtual void ApplyForce (WVector3 force, WVector3 relative_pos)=0
 
virtual void ApplyImpulse (WVector3 impulse)=0
 
virtual void ApplyImpulse (WVector3 impulse, WVector3 relative_pos)=0
 
virtual void ApplyTorque (WVector3 torque)=0
 
virtual WVector3 getLinearVelocity () const =0
 
virtual WVector3 getAngularVelocity () const =0
 
virtual WVector3 getTotalForce () const =0
 
virtual WVector3 getTotalTorque () const =0
 
virtual void OnStateChange (STATE_CHANGE_TYPE type)=0
 
virtual WError SaveToStream (WFile *file, std::ostream &outputStream)=0
 
virtual WError LoadFromStream (WFile *file, std::istream &inputStream, std::vector< void * > &args, std::string nameSuffix)=0
 
- Public Member Functions inherited from WBase
 WBase (class Wasabi *const app, uint32_t ID=0)
 
virtual void SetID (uint32_t newID)=0
 
virtual void SetName (std::string newName)=0
 
uint32_t GetID () const
 
std::string GetName () const
 
class WasabiGetAppPtr () const
 
void AddReference ()
 
void RemoveReference ()
 
- Public Member Functions inherited from WOrientation
void SetPosition (float x, float y, float z)
 
void SetPosition (const WVector3 pos)
 
void Point (float x, float y, float z)
 
void Point (WVector3 target)
 
void SetAngle (WQuaternion quat)
 
void SetToRotation (const WOrientation *const device)
 
void SetULRVectors (WVector3 up, WVector3 look, WVector3 right)
 
void SetToTransformation (WMatrix mtx)
 
void Yaw (float angle)
 
void Roll (float angle)
 
void Pitch (float angle)
 
void Move (float units)
 
void Strafe (float units)
 
void Fly (float units)
 
float GetPositionX () const
 
float GetPositionY () const
 
float GetPositionZ () const
 
WVector3 GetPosition () const
 
float GetAngleX () const
 
float GetAngleY () const
 
float GetAngleZ () const
 
WQuaternion GetRotation () const
 
WVector3 GetUVector () const
 
WVector3 GetLVector () const
 
WVector3 GetRVector () const
 
virtual void SetBindingMatrix (WMatrix mtx)
 
void RemoveBinding ()
 
WMatrix GetBindingMatrix () const
 
bool IsBound () const
 
WMatrix ComputeTransformation () const
 
WMatrix ComputeInverseTransformation () const
 

Additional Inherited Members

- Protected Attributes inherited from WBase
class Wasabim_app
 
uint32_t m_ID
 
std::string m_name
 

Detailed Description

This is an interface for implementing a rigid body.

Member Function Documentation

◆ ApplyForce() [1/2]

virtual void WRigidBody::ApplyForce ( WVector3  force)
pure virtual

Applies force to the center of the rigid body

Implemented in WBulletRigidBody.

◆ ApplyForce() [2/2]

virtual void WRigidBody::ApplyForce ( WVector3  force,
WVector3  relative_pos 
)
pure virtual

Applies force to the rigid body relative to a coordinate (will also apply rotation)

Implemented in WBulletRigidBody.

◆ ApplyImpulse() [1/2]

virtual void WRigidBody::ApplyImpulse ( WVector3  impulse)
pure virtual

Applies an impulse to the center of the rigid body

Implemented in WBulletRigidBody.

◆ ApplyImpulse() [2/2]

virtual void WRigidBody::ApplyImpulse ( WVector3  impulse,
WVector3  relative_pos 
)
pure virtual

Applies an impulse to the rigid body relative to a coordinate

Implemented in WBulletRigidBody.

◆ ApplyTorque()

virtual void WRigidBody::ApplyTorque ( WVector3  torque)
pure virtual

Applies torque to the rigid body

Implemented in WBulletRigidBody.

◆ BindObject()

virtual void WRigidBody::BindObject ( WOrientation obj,
WBase objBase = nullptr 
)
pure virtual

Must be implemented to attach a WOrientation to this rigid body

Parameters
objA WOrientation (WObject, WCamera, etc...) to attach
objBaseAn optional (but highly recommended) parameter to specify the WBase* pointer that obj is associated with. This will cause the rigid body to hold a reference to the object until unbound.

Implemented in WBulletRigidBody.

◆ Create()

virtual WError WRigidBody::Create ( W_RIGID_BODY_CREATE_INFO  createInfo,
bool  bSaveInfo = false 
)
pure virtual

Must be implemented to initialize the rigid body.

Parameters
createInfoVarious parameters for the rigid body creation
bSaveInfoIf set to true, the rigid body will store the creation information so that it can be later saved to file
Returns
Error code, see WError.h

Implemented in WBulletRigidBody.

◆ getAngularVelocity()

virtual WVector3 WRigidBody::getAngularVelocity ( ) const
pure virtual

Retrieves the angular velocity of the rigid body

Implemented in WBulletRigidBody.

◆ getLinearVelocity()

virtual WVector3 WRigidBody::getLinearVelocity ( ) const
pure virtual

Retrieves the linear velocity of the rigid body

Implemented in WBulletRigidBody.

◆ getTotalForce()

virtual WVector3 WRigidBody::getTotalForce ( ) const
pure virtual

Retrieves the total force currently applied on the rigid body

Implemented in WBulletRigidBody.

◆ getTotalTorque()

virtual WVector3 WRigidBody::getTotalTorque ( ) const
pure virtual

Retrieves the total torque currently applied on the rigid body

Implemented in WBulletRigidBody.

◆ OnStateChange() [1/2]

void WRigidBody::OnStateChange ( STATE_CHANGE_TYPE  type)
virtual

A callback called by this class when the entity changes its position or orientation.

Parameters
typeOrientation change type

Reimplemented from WOrientation.

◆ OnStateChange() [2/2]

virtual void WRigidBody::OnStateChange ( STATE_CHANGE_TYPE  type)
pure virtual

A callback called by this class when the entity changes its position or orientation.

Parameters
typeOrientation change type

Reimplemented from WOrientation.

Implemented in WBulletRigidBody.

◆ SetAngularDamping()

virtual void WRigidBody::SetAngularDamping ( float  power)
pure virtual

Sets the angular damping of the rigid body

Implemented in WBulletRigidBody.

◆ SetAngularVelocity()

virtual void WRigidBody::SetAngularVelocity ( WVector3  vel)
pure virtual

Sets the angular velocity of the rigid body

Implemented in WBulletRigidBody.

◆ SetBouncingPower()

virtual void WRigidBody::SetBouncingPower ( float  bouncing)
pure virtual

Sets the bouncing power (restitution) of the rigid body

Implemented in WBulletRigidBody.

◆ SetFriction()

virtual void WRigidBody::SetFriction ( float  friction)
pure virtual

Sets the friction of the rigid body

Implemented in WBulletRigidBody.

◆ SetLinearDamping()

virtual void WRigidBody::SetLinearDamping ( float  power)
pure virtual

Sets the linear damping of the rigid body

Implemented in WBulletRigidBody.

◆ SetLinearVelocity()

virtual void WRigidBody::SetLinearVelocity ( WVector3  vel)
pure virtual

Sets the linear velocity of the rigid body

Implemented in WBulletRigidBody.

◆ SetMass()

virtual void WRigidBody::SetMass ( float  mass)
pure virtual

Sets the mass of the rigid body

Implemented in WBulletRigidBody.

◆ SetMassCenter()

virtual void WRigidBody::SetMassCenter ( float  x,
float  y,
float  z 
)
pure virtual

Sets the center of mass of the rigid body

Implemented in WBulletRigidBody.

◆ Update()

virtual void WRigidBody::Update ( float  deltaTime)
pure virtual

Called by WBulletPhysics after stepping the physics simulation to update the rigid bodies.

Parameters
deltaTimeTime elapsed since last frame

Implemented in WBulletRigidBody.

◆ Valid()

bool WRigidBody::Valid ( ) const
virtual

Must be implemented by the child. This function should report the validity status of the object, in whatever sense of "validity" it chooses.

Returns
true if the object is "valid", false otherwise

Implements WBase.


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