vrsode::PhysicsBody Class Reference

Physical Body for SceneThings. More...

#include <PhysicsBody.h>

Inheritance diagram for vrsode::PhysicsBody:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 PhysicsBody (VRS::SO< VRS::SceneThing >, CollisionShape, bool forceSync=false)
 ctor.
 PhysicsBody (VRS::SO< VRS::SceneThing >, VRS::SO< Shape >, bool forceSync=false)
 ctor.
 ~PhysicsBody ()
 dtor.
dBodyID bodyId ()
 get the body id.
double mass ()
 get the bodies mass.
void setMass (double, VRS::Vector=VRS::Vector(0, 0, 0))
 set the bodies mass.
bool isEnabled () const
 is enabled.
void setEnabled (bool)
 enable or disable an object.
void setAutoDisableMode (bool)
 set auto disable mode.
void setAutoDisableLinearThreshold (double)
 set auto disable linear threshold.
void setAutoDisableAngularThreshold (double)
 set auto disable angular threshold.
void setAutoDisableTime (double)
 set disable time.
void setAutoDisableSteps (unsigned int)
 set disable steps.
void setHighSpeedRotationMode (bool=true)
 set high speed rotation mode.
void setHighSpeedRotationAxis (VRS::Vector)
 set the high speed rotation axis.
void setHighSpeedRotationAxis (double, double, double)
 set the high speed rotation axis.
void setIgnoreGravity (bool=true)
 ignore gravity.
void syncTransformationsToODE ()
 synconize transformations to ode.
void syncTransformationsToVRS ()
 syncronize transformations to vrs.
void update ()
 this functions performs opertations needed after every physics tick.
void setAngularVelocity (VRS::Vector)
 set angular velocity.
void setLinearVelocity (VRS::Vector)
 set linear velocity.
VRS::Vector angularVelocity ()
 get the angular velocity.
VRS::Vector linearVelocity ()
 get the linear velocity.
void addForce (VRS::Vector)
 add a force.
void addTorque (VRS::Vector)
 add a torque.
void addRelativeForce (VRS::Vector)
 add a relative force.
void addRelativeTorque (VRS::Vector)
 add a relative torque.
void addForceAtPosition (VRS::Vector, VRS::Vector)
 add a force at position.
void addRelativeForceAtPosition (VRS::Vector, VRS::Vector)
 add a relative force at position.
void addForceAtRelativePosition (VRS::Vector, VRS::Vector)
 add a force at relative position.
void addRelativeForceAtRelativePosition (VRS::Vector, VRS::Vector)
 add a relative force at relative position.
virtual void destroy ()
 destroys this collision body.

Private Attributes

dBodyID m_bodyId
bool m_highSpeedRotationMode
VRS::Vector m_highSpeedRotationAxis
bool m_forceSync

Detailed Description

Physical Body for SceneThings.

Definition at line 16 of file PhysicsBody.h.


Constructor & Destructor Documentation

vrsode::PhysicsBody::PhysicsBody ( VRS::SO< VRS::SceneThing >  ,
CollisionShape  ,
bool  forceSync = false 
)

ctor.

Definition at line 17 of file PhysicsBody.cpp.

References vrsode::CollisionBody::geomId(), vrsode::PhysicsManager::get(), m_bodyId, m_forceSync, m_highSpeedRotationAxis, m_highSpeedRotationMode, vrsode::PhysicsManager::registerPhysicsBody(), setMass(), and vrsode::PhysicsManager::worldId().

Here is the call graph for this function:

vrsode::PhysicsBody::PhysicsBody ( VRS::SO< VRS::SceneThing >  ,
VRS::SO< Shape ,
bool  forceSync = false 
)

ctor.

Definition at line 39 of file PhysicsBody.cpp.

References vrsode::CollisionBody::geomId(), vrsode::PhysicsManager::get(), m_bodyId, m_forceSync, m_highSpeedRotationAxis, m_highSpeedRotationMode, vrsode::PhysicsManager::registerPhysicsBody(), setMass(), and vrsode::PhysicsManager::worldId().

Here is the call graph for this function:

vrsode::PhysicsBody::~PhysicsBody (  ) 

dtor.

Definition at line 61 of file PhysicsBody.cpp.


Member Function Documentation

dBodyID vrsode::PhysicsBody::bodyId (  ) 

get the body id.

this id i used by ode to identfy the physical body.

Definition at line 74 of file PhysicsBody.cpp.

References m_bodyId.

Referenced by destroy().

Here is the caller graph for this function:

double vrsode::PhysicsBody::mass (  ) 

get the bodies mass.

this is the mass value of the body. as the doc says, 0.1 - 10 are good values to produce stable simulations.

Definition at line 80 of file PhysicsBody.cpp.

References m_bodyId.

Referenced by setMass().

Here is the caller graph for this function:

void vrsode::PhysicsBody::setMass ( double  ,
VRS::Vector  = VRS::Vector(0, 0, 0) 
)

set the bodies mass.

set the amount and the center of mass.

Definition at line 88 of file PhysicsBody.cpp.

References m_bodyId, and mass().

Referenced by PhysicsBody().

Here is the call graph for this function:

Here is the caller graph for this function:

bool vrsode::PhysicsBody::isEnabled (  )  const

is enabled.

returns whether the object is enabled and influences the simulation.

Definition at line 223 of file PhysicsBody.cpp.

References m_bodyId.

void vrsode::PhysicsBody::setEnabled ( bool   ) 

enable or disable an object.

this function forces an object to be enabled or disabled.

Definition at line 229 of file PhysicsBody.cpp.

References m_bodyId.

void vrsode::PhysicsBody::setAutoDisableMode ( bool   ) 

set auto disable mode.

set whether the object should be automatically disabled.

Definition at line 235 of file PhysicsBody.cpp.

References m_bodyId.

void vrsode::PhysicsBody::setAutoDisableLinearThreshold ( double   ) 

set auto disable linear threshold.

if the linear velocity of an object falls below this value, the object gets disabled automatically.

Definition at line 241 of file PhysicsBody.cpp.

References m_bodyId.

void vrsode::PhysicsBody::setAutoDisableAngularThreshold ( double   ) 

set auto disable angular threshold.

if the angular velocity of an object falls below this value, the object gets disabled automatically.

Definition at line 247 of file PhysicsBody.cpp.

References m_bodyId.

void vrsode::PhysicsBody::setAutoDisableTime ( double   ) 

set disable time.

set the time an object needs to be idle to get disabled.

Definition at line 253 of file PhysicsBody.cpp.

References m_bodyId.

void vrsode::PhysicsBody::setAutoDisableSteps ( unsigned  int  ) 

set disable steps.

set the amount of simulation steps an object to be idle to get disabled.

Definition at line 259 of file PhysicsBody.cpp.

References m_bodyId.

void vrsode::PhysicsBody::setHighSpeedRotationMode ( bool  = true  ) 

set high speed rotation mode.

if this mode is enabled, ode uses some extra algorithm to handle high speed rotations. for example for wheels. since this takes more time to compute, only use this mode if you really need it.

Definition at line 102 of file PhysicsBody.cpp.

References m_bodyId, m_highSpeedRotationAxis, and m_highSpeedRotationMode.

Referenced by update().

Here is the caller graph for this function:

void vrsode::PhysicsBody::setHighSpeedRotationAxis ( VRS::Vector   ) 

set the high speed rotation axis.

use this function to provide ode with extra information about the high speed rotation. calling this function enables high speed rotation mode. have a look in setHighSpeedRotationMode().

Definition at line 123 of file PhysicsBody.cpp.

void vrsode::PhysicsBody::setHighSpeedRotationAxis ( double  ,
double  ,
double   
)

set the high speed rotation axis.

this function is the same as the one above, you just to not need to provide a vector.

Definition at line 115 of file PhysicsBody.cpp.

References m_highSpeedRotationAxis.

void vrsode::PhysicsBody::setIgnoreGravity ( bool  = true  ) 

ignore gravity.

use this function to tell the object to ignore gravity. may be usefull for some funny effects.

Definition at line 129 of file PhysicsBody.cpp.

References m_bodyId.

void vrsode::PhysicsBody::syncTransformationsToODE (  )  [virtual]

synconize transformations to ode.

this function syncronizes transformations done on the VRS representation of the object back to ode.

Reimplemented from vrsode::CollisionBody.

Definition at line 144 of file PhysicsBody.cpp.

References m_bodyId, vrsode::CollisionBody::odeShape(), vrsode::CollisionBody::position(), and vrsode::CollisionBody::rotation().

Here is the call graph for this function:

void vrsode::PhysicsBody::syncTransformationsToVRS (  ) 

syncronize transformations to vrs.

this function syncronizes tranformations done on the ode body back the vrs object.

Definition at line 178 of file PhysicsBody.cpp.

References vrsode::CollisionBody::debugNode(), m_bodyId, m_forceSync, vrsode::CollisionBody::odeShape(), vrsode::CollisionBody::rotation(), vrsode::CollisionBody::translationNode(), and vrsode::CollisionBody::vrsShape().

Here is the call graph for this function:

void vrsode::PhysicsBody::update (  )  [virtual]

this functions performs opertations needed after every physics tick.

this does _NOT_ synchronize back to vrs.

Reimplemented from vrsode::CollisionBody.

Definition at line 135 of file PhysicsBody.cpp.

References m_highSpeedRotationMode, setHighSpeedRotationMode(), and vrsode::CollisionBody::update().

Here is the call graph for this function:

void vrsode::PhysicsBody::setAngularVelocity ( VRS::Vector   ) 

set angular velocity.

this sets the rotation speed of the body.

Note:
applying forces should be prefered to keep the simulation stable.

Definition at line 265 of file PhysicsBody.cpp.

References m_bodyId.

void vrsode::PhysicsBody::setLinearVelocity ( VRS::Vector   ) 

set linear velocity.

this sets the speed of the body.

Note:
applying forces should be prefered to keep the simulation stable.

Definition at line 272 of file PhysicsBody.cpp.

References m_bodyId.

VRS::Vector vrsode::PhysicsBody::angularVelocity (  ) 

get the angular velocity.

returns the angular velocity of this body.

Definition at line 279 of file PhysicsBody.cpp.

References m_bodyId.

VRS::Vector vrsode::PhysicsBody::linearVelocity (  ) 

get the linear velocity.

returns the linear velocity of this body.

Definition at line 286 of file PhysicsBody.cpp.

References m_bodyId.

void vrsode::PhysicsBody::addForce ( VRS::Vector   ) 

add a force.

adds a force to the body.

Definition at line 293 of file PhysicsBody.cpp.

References m_bodyId.

void vrsode::PhysicsBody::addTorque ( VRS::Vector   ) 

add a torque.

adds a rotation force to the body.

Definition at line 299 of file PhysicsBody.cpp.

References m_bodyId.

void vrsode::PhysicsBody::addRelativeForce ( VRS::Vector   ) 

add a relative force.

adds a force relative to the body.

Definition at line 305 of file PhysicsBody.cpp.

References m_bodyId.

void vrsode::PhysicsBody::addRelativeTorque ( VRS::Vector   ) 

add a relative torque.

adds a torque relative to the body.

Definition at line 311 of file PhysicsBody.cpp.

References m_bodyId.

void vrsode::PhysicsBody::addForceAtPosition ( VRS::Vector  ,
VRS::Vector   
)

add a force at position.

adds a force at a position to the body.

Definition at line 317 of file PhysicsBody.cpp.

References m_bodyId.

void vrsode::PhysicsBody::addRelativeForceAtPosition ( VRS::Vector  ,
VRS::Vector   
)

add a relative force at position.

adds a force relative to the body at a position to the body.

Definition at line 324 of file PhysicsBody.cpp.

References m_bodyId.

void vrsode::PhysicsBody::addForceAtRelativePosition ( VRS::Vector  ,
VRS::Vector   
)

add a force at relative position.

adds a force to the body at a position relative to the body.

Definition at line 332 of file PhysicsBody.cpp.

References m_bodyId.

void vrsode::PhysicsBody::addRelativeForceAtRelativePosition ( VRS::Vector  ,
VRS::Vector   
)

add a relative force at relative position.

adds a force, relative to the body, at a position, relative to the body, to the body.

Definition at line 340 of file PhysicsBody.cpp.

References m_bodyId.

void vrsode::PhysicsBody::destroy (  )  [virtual]

destroys this collision body.

Reimplemented from vrsode::CollisionBody.

Definition at line 66 of file PhysicsBody.cpp.

References bodyId(), vrsode::CollisionBody::geomId(), vrsode::PhysicsManager::get(), and vrsode::PhysicsManager::unregisterCollisionBody().

Here is the call graph for this function:


Member Data Documentation

dBodyID vrsode::PhysicsBody::m_bodyId [private]

Definition at line 18 of file PhysicsBody.h.

Referenced by addForce(), addForceAtPosition(), addForceAtRelativePosition(), addRelativeForce(), addRelativeForceAtPosition(), addRelativeForceAtRelativePosition(), addRelativeTorque(), addTorque(), angularVelocity(), bodyId(), isEnabled(), linearVelocity(), mass(), PhysicsBody(), setAngularVelocity(), setAutoDisableAngularThreshold(), setAutoDisableLinearThreshold(), setAutoDisableMode(), setAutoDisableSteps(), setAutoDisableTime(), setEnabled(), setHighSpeedRotationMode(), setIgnoreGravity(), setLinearVelocity(), setMass(), syncTransformationsToODE(), and syncTransformationsToVRS().

bool vrsode::PhysicsBody::m_highSpeedRotationMode [private]

Definition at line 20 of file PhysicsBody.h.

Referenced by PhysicsBody(), setHighSpeedRotationMode(), and update().

VRS::Vector vrsode::PhysicsBody::m_highSpeedRotationAxis [private]

Definition at line 21 of file PhysicsBody.h.

Referenced by PhysicsBody(), setHighSpeedRotationAxis(), and setHighSpeedRotationMode().

bool vrsode::PhysicsBody::m_forceSync [private]

Definition at line 23 of file PhysicsBody.h.

Referenced by PhysicsBody(), and syncTransformationsToVRS().


The documentation for this class was generated from the following files:
Generated on Fri May 11 21:02:16 2007 for Random Racer by  doxygen 1.5.1