vrsode::CollisionBody Class Reference

collision body for scene things. More...

#include <CollisionBody.h>

Inheritance diagram for vrsode::CollisionBody:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 CollisionBody (VRS::SO< VRS::SceneThing >, CollisionShape, bool=true)
 ctor.
 CollisionBody (VRS::SO< VRS::SceneThing >, VRS::SO< Shape >, bool=true)
 ctor.
virtual ~CollisionBody ()
 dtor.
VRS::SO< VRS::SceneThing > sceneThing () const
 get the scene thing.
const dGeomID geomId () const
 get the geometry id.
const CollisionShape collisionShape () const
 get the collision shape of this body.
virtual void setDebugNode (bool=true)
 set debug mode.
const VRS::Vector position () const
 get the position.
void setPosition (VRS::Vector)
 set the position.
void setPosition (double, double, double)
 set the position.
const VRS::Matrix & rotation () const
 get the rotation.
void setRotation (VRS::Vector, double)
 set the rotation.
void setRotation (double, double, double, double)
 set the rotation.
VRS::SO< VRS::Translation > translationNode ()
 get the translation node.
VRS::SO< VRS::Rotation > rotationNode ()
 get the rotation node.
VRS::SO< VRS::Shape > vrsShape ()
 get the shape node.
virtual void syncTransformationsToODE ()
 synconize transformations to ode.
virtual void handleCollision (VRS::SO< CollisionBody >)
 handle a collision.
void setSurface (VRS::SO< Surface >)
 set this objects surface.
VRS::SO< Surfacesurface ()
 get this objets surface.
VRS::SO< ShapeodeShape ()
 get this objects shape.
bool debugNode ()
 whether this object has its debug node enabled
void setCollisionCategory (unsigned int)
 set the collision category this object is in.
unsigned int collisionCategory ()
 get the collision category this object is in.
void setCollisionPartnerCategories (unsigned int)
 set the collision categories, this object can collide with.
unsigned int collisionPartnerCategories ()
 get the collision categories, this object can collide with.
VRS::SO< SceneNodeLocksceneNodeLock ()
 get the locker object.
void setReportCollision (bool)
 whether to report collisions via debug output.
virtual void destroy ()
 destroys this collision body.
void wantToDestroy ()
 request a destruction of the object, it will happen in the next update.
virtual void update ()
 run several things needed in any update loop.
bool wantsToGetDestroyed ()
 whether this object wants to get destroyed

Protected Member Functions

void setupTransformationNodes ()
void insertLocker ()
bool cleanedUp ()
void setCleanedUp (bool)

Private Attributes

VRS::SO< VRS::SceneThing > m_sceneThing
VRS::SO< VRS::Translation > m_translation
VRS::SO< VRS::Rotation > m_rotation
VRS::SO< VRS::Shape > m_vrsShape
dGeomID m_geomId
CollisionShape m_collisionShape
VRS::SO< Surfacem_surface
VRS::SO< Shapem_odeShape
VRS::SO< SceneNodeLockm_sceneNodeLock
bool m_reportCollision
bool m_cleanedUp
bool m_wantToDestroy

Detailed Description

collision body for scene things.

Definition at line 34 of file CollisionBody.h.


Constructor & Destructor Documentation

vrsode::CollisionBody::CollisionBody ( VRS::SO< VRS::SceneThing >  ,
CollisionShape  ,
bool  = true 
)

ctor.

this constructor generates a shape dependent on CollisionShape type.

Definition at line 31 of file CollisionBody.cpp.

References vrsode::CS_Box, vrsode::CS_None, vrsode::CS_Sphere, vrsode::PhysicsManager::get(), m_cleanedUp, m_collisionShape, m_geomId, m_odeShape, m_reportCollision, m_sceneThing, m_wantToDestroy, rErr, setSurface(), setupTransformationNodes(), and syncTransformationsToODE().

Here is the call graph for this function:

vrsode::CollisionBody::CollisionBody ( VRS::SO< VRS::SceneThing >  ,
VRS::SO< Shape ,
bool  = true 
)

ctor.

this constructor takes a preconstructed shape.

Definition at line 77 of file CollisionBody.cpp.

References vrsode::PhysicsManager::get(), m_cleanedUp, m_collisionShape, m_geomId, m_odeShape, m_reportCollision, m_sceneNodeLock, m_sceneThing, m_wantToDestroy, setSurface(), setupTransformationNodes(), and syncTransformationsToODE().

Here is the call graph for this function:

vrsode::CollisionBody::~CollisionBody (  )  [virtual]

dtor.

Definition at line 103 of file CollisionBody.cpp.


Member Function Documentation

void vrsode::CollisionBody::setupTransformationNodes (  )  [protected]

Definition at line 148 of file CollisionBody.cpp.

References m_rotation, m_sceneThing, m_translation, m_vrsShape, and rErr.

Referenced by CollisionBody().

Here is the caller graph for this function:

void vrsode::CollisionBody::insertLocker (  )  [protected]

Definition at line 202 of file CollisionBody.cpp.

References m_sceneNodeLock, and m_sceneThing.

bool vrsode::CollisionBody::cleanedUp (  )  [protected]

Definition at line 118 of file CollisionBody.cpp.

References m_cleanedUp.

void vrsode::CollisionBody::setCleanedUp ( bool   )  [protected]

Definition at line 124 of file CollisionBody.cpp.

References m_cleanedUp.

VRS::SO< VRS::SceneThing > vrsode::CollisionBody::sceneThing (  )  const

get the scene thing.

returns the scene thing of this collision body.

Definition at line 130 of file CollisionBody.cpp.

References m_sceneThing.

const dGeomID vrsode::CollisionBody::geomId (  )  const

get the geometry id.

return the geometry id ode uses to identify this object.

Definition at line 136 of file CollisionBody.cpp.

References m_geomId.

Referenced by vrsode::PhysicsBody::destroy(), destroy(), and vrsode::PhysicsBody::PhysicsBody().

Here is the caller graph for this function:

const CollisionShape vrsode::CollisionBody::collisionShape (  )  const

get the collision shape of this body.

returns the collision shape of this body, whether it is a box, sphere or whatever.

Definition at line 142 of file CollisionBody.cpp.

References m_collisionShape.

void vrsode::CollisionBody::setDebugNode ( bool  = true  )  [virtual]

set debug mode.

this enables debug. if debug mode is enabled, an object representing the collision body is drawn.

Definition at line 302 of file CollisionBody.cpp.

References m_odeShape, and m_sceneThing.

Referenced by vrsode::SampleBox::SampleBox(), and vrsode::SamplePlane::SamplePlane().

Here is the caller graph for this function:

const VRS::Vector vrsode::CollisionBody::position (  )  const

get the position.

returns the current possition of the collision body.

Definition at line 214 of file CollisionBody.cpp.

References m_translation.

Referenced by vrsode::PhysicsBody::syncTransformationsToODE(), and syncTransformationsToODE().

Here is the caller graph for this function:

void vrsode::CollisionBody::setPosition ( VRS::Vector   ) 

set the position.

sets the position of this collision body.

Note:
setting the position during simulation may cause unexpected results. Do not do it!

Definition at line 226 of file CollisionBody.cpp.

References m_translation, and syncTransformationsToODE().

Referenced by random_racer::CollectableCoin::CollectableCoin(), and setPosition().

Here is the call graph for this function:

Here is the caller graph for this function:

void vrsode::CollisionBody::setPosition ( double  ,
double  ,
double   
)

set the position.

see setPosition().

Definition at line 220 of file CollisionBody.cpp.

References setPosition().

Here is the call graph for this function:

const VRS::Matrix & vrsode::CollisionBody::rotation (  )  const

get the rotation.

the the current rotation of the object as a rotation matrix.

Definition at line 235 of file CollisionBody.cpp.

References m_rotation.

Referenced by vrsode::PhysicsBody::syncTransformationsToODE(), syncTransformationsToODE(), and vrsode::PhysicsBody::syncTransformationsToVRS().

Here is the caller graph for this function:

void vrsode::CollisionBody::setRotation ( VRS::Vector  ,
double   
)

set the rotation.

sets the rotation of the collision body.

Note:
setting rotation while simulation may cause unexpected results. Do not do it!

Definition at line 249 of file CollisionBody.cpp.

References m_odeShape, m_rotation, and syncTransformationsToODE().

Referenced by setRotation().

Here is the call graph for this function:

Here is the caller graph for this function:

void vrsode::CollisionBody::setRotation ( double  ,
double  ,
double  ,
double   
)

set the rotation.

see setRotation().

Definition at line 242 of file CollisionBody.cpp.

References setRotation().

Here is the call graph for this function:

VRS::SO< VRS::Translation > vrsode::CollisionBody::translationNode (  ) 

get the translation node.

this returns the scene graph object representing the current translation.

Note:
if you have this object, unexpected results may occur. Do note touch positions while simulating!

Definition at line 319 of file CollisionBody.cpp.

References m_translation.

Referenced by vrsode::PhysicsBody::syncTransformationsToVRS().

Here is the caller graph for this function:

VRS::SO< VRS::Rotation > vrsode::CollisionBody::rotationNode (  ) 

get the rotation node.

this returns the scene graph object representing the current rotation.

Note:
do not touch the rotation while simulating. Unexpected results will occur otherwise.

Definition at line 325 of file CollisionBody.cpp.

References m_rotation.

VRS::SO< VRS::Shape > vrsode::CollisionBody::vrsShape (  ) 

get the shape node.

this returns the vrs shape node of this object. this may be a torus, a plane, a polygonset or whatever.

Definition at line 331 of file CollisionBody.cpp.

References m_vrsShape.

Referenced by vrsode::PhysicsBody::syncTransformationsToVRS().

Here is the caller graph for this function:

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

synconize transformations to ode.

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

Reimplemented in vrsode::PhysicsBody.

Definition at line 265 of file CollisionBody.cpp.

References m_geomId, m_odeShape, position(), and rotation().

Referenced by CollisionBody(), setPosition(), and setRotation().

Here is the call graph for this function:

Here is the caller graph for this function:

void vrsode::CollisionBody::handleCollision ( VRS::SO< CollisionBody  )  [virtual]

handle a collision.

this functions gets called if this object collided with something else. the collision partner is passed as argument. to implement certain special collision behaviour, extent this class and overwrite this function.

Reimplemented in random_racer::ReloadPlane::PlaneWrapper, vrsode::SampleBox, and vrsode::SamplePlane.

Definition at line 337 of file CollisionBody.cpp.

References m_reportCollision.

void vrsode::CollisionBody::setSurface ( VRS::SO< Surface  ) 

set this objects surface.

Definition at line 344 of file CollisionBody.cpp.

References m_surface.

Referenced by CollisionBody().

Here is the caller graph for this function:

VRS::SO< Surface > vrsode::CollisionBody::surface (  ) 

get this objets surface.

Definition at line 350 of file CollisionBody.cpp.

References m_surface.

Referenced by random_racer::CollectableCoin::CollectableCoin(), vrsode::SampleBox::SampleBox(), and vrsode::SamplePlane::SamplePlane().

Here is the caller graph for this function:

VRS::SO< Shape > vrsode::CollisionBody::odeShape (  ) 

get this objects shape.

Definition at line 356 of file CollisionBody.cpp.

References m_odeShape.

Referenced by vrsode::PhysicsBody::syncTransformationsToODE(), and vrsode::PhysicsBody::syncTransformationsToVRS().

Here is the caller graph for this function:

bool vrsode::CollisionBody::debugNode (  ) 

whether this object has its debug node enabled

Definition at line 362 of file CollisionBody.cpp.

References m_odeShape.

Referenced by vrsode::PhysicsBody::syncTransformationsToVRS().

Here is the caller graph for this function:

void vrsode::CollisionBody::setCollisionCategory ( unsigned  int  ) 

set the collision category this object is in.

Definition at line 370 of file CollisionBody.cpp.

References m_geomId.

Referenced by random_racer::CollectableCoin::CollectableCoin().

Here is the caller graph for this function:

unsigned int vrsode::CollisionBody::collisionCategory (  ) 

get the collision category this object is in.

Definition at line 378 of file CollisionBody.cpp.

References m_geomId.

void vrsode::CollisionBody::setCollisionPartnerCategories ( unsigned  int  ) 

set the collision categories, this object can collide with.

Definition at line 388 of file CollisionBody.cpp.

References m_geomId.

unsigned int vrsode::CollisionBody::collisionPartnerCategories (  ) 

get the collision categories, this object can collide with.

Definition at line 396 of file CollisionBody.cpp.

References m_geomId.

VRS::SO< SceneNodeLock > vrsode::CollisionBody::sceneNodeLock (  ) 

get the locker object.

Definition at line 406 of file CollisionBody.cpp.

References m_sceneNodeLock.

void vrsode::CollisionBody::setReportCollision ( bool   ) 

whether to report collisions via debug output.

Definition at line 412 of file CollisionBody.cpp.

References m_reportCollision.

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

destroys this collision body.

Reimplemented in vrsode::PhysicsBody.

Definition at line 110 of file CollisionBody.cpp.

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

Referenced by update().

Here is the call graph for this function:

Here is the caller graph for this function:

void vrsode::CollisionBody::wantToDestroy (  ) 

request a destruction of the object, it will happen in the next update.

Definition at line 418 of file CollisionBody.cpp.

References m_wantToDestroy.

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

run several things needed in any update loop.

Reimplemented in vrsode::PhysicsBody.

Definition at line 424 of file CollisionBody.cpp.

References destroy(), and m_wantToDestroy.

Referenced by vrsode::PhysicsBody::update().

Here is the call graph for this function:

Here is the caller graph for this function:

bool vrsode::CollisionBody::wantsToGetDestroyed (  ) 

whether this object wants to get destroyed


Member Data Documentation

VRS::SO<VRS::SceneThing> vrsode::CollisionBody::m_sceneThing [private]

Definition at line 36 of file CollisionBody.h.

Referenced by CollisionBody(), insertLocker(), sceneThing(), setDebugNode(), and setupTransformationNodes().

VRS::SO<VRS::Translation> vrsode::CollisionBody::m_translation [private]

Definition at line 38 of file CollisionBody.h.

Referenced by position(), setPosition(), setupTransformationNodes(), and translationNode().

VRS::SO<VRS::Rotation> vrsode::CollisionBody::m_rotation [private]

Reimplemented in random_racer::CollectableCoin.

Definition at line 39 of file CollisionBody.h.

Referenced by rotation(), rotationNode(), setRotation(), and setupTransformationNodes().

VRS::SO<VRS::Shape> vrsode::CollisionBody::m_vrsShape [private]

Definition at line 41 of file CollisionBody.h.

Referenced by setupTransformationNodes(), and vrsShape().

dGeomID vrsode::CollisionBody::m_geomId [private]

Definition at line 43 of file CollisionBody.h.

Referenced by CollisionBody(), collisionCategory(), collisionPartnerCategories(), geomId(), setCollisionCategory(), setCollisionPartnerCategories(), and syncTransformationsToODE().

CollisionShape vrsode::CollisionBody::m_collisionShape [private]

Definition at line 44 of file CollisionBody.h.

Referenced by CollisionBody(), and collisionShape().

VRS::SO<Surface> vrsode::CollisionBody::m_surface [private]

Definition at line 46 of file CollisionBody.h.

Referenced by setSurface(), and surface().

VRS::SO<Shape> vrsode::CollisionBody::m_odeShape [private]

Definition at line 47 of file CollisionBody.h.

Referenced by CollisionBody(), debugNode(), odeShape(), setDebugNode(), setRotation(), and syncTransformationsToODE().

VRS::SO<SceneNodeLock> vrsode::CollisionBody::m_sceneNodeLock [private]

Definition at line 49 of file CollisionBody.h.

Referenced by CollisionBody(), insertLocker(), and sceneNodeLock().

bool vrsode::CollisionBody::m_reportCollision [private]

Definition at line 51 of file CollisionBody.h.

Referenced by CollisionBody(), handleCollision(), and setReportCollision().

bool vrsode::CollisionBody::m_cleanedUp [private]

Definition at line 53 of file CollisionBody.h.

Referenced by cleanedUp(), CollisionBody(), destroy(), and setCleanedUp().

bool vrsode::CollisionBody::m_wantToDestroy [private]

Definition at line 55 of file CollisionBody.h.

Referenced by CollisionBody(), update(), and wantToDestroy().


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