Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

oxygen::Collider Class Reference

ODE geometry object- geom for short. More...

#include <collider.h>

Inheritance diagram for oxygen::Collider:

Inheritance graph
[legend]
Collaboration diagram for oxygen::Collider:

Collaboration graph
[legend]
List of all members.

Public Types

enum  ECollisionType { CT_DIRECT, CT_SYMMETRIC }
 enumerates the two different collision instances reported to the OnCollision member for each collision reported from ODE. More...

Public Member Functions

 Collider ()
virtual ~Collider ()
virtual void OnCollision (boost::shared_ptr< Collider > collidee, dContact &contact, ECollisionType type)
 notifies the Collider that a collision with another geometry object has occured.
bool AddCollisionHandler (const std::string &handlerName)
 registers a new collision handler to this collider.
dGeomID GetODEGeom ()
 returns the ID of managed ODE geom
virtual void SetPosition (const salt::Vector3f &pos)
 sets the relative position of the managed geom directly.
virtual void SetRotation (const salt::Matrix &rot)
 sets the relative orientation of the managed geom directly.
bool Intersects (boost::shared_ptr< Collider > collider)
 returns true if the ODE geom managed by this Collider intersects with the geom managed by the given collider

Static Public Member Functions

static boost::shared_ptr<
Collider
GetCollider (dGeomID id)
 returns the Collider corresponding to the given ODE geom

Protected Member Functions

virtual void OnLink ()
 registers the managed geom to the Space of the Scene and to the associated ODE body
virtual void OnUnlink ()
 unregisters the managed geom from the Space of the Scene.
virtual void PrePhysicsUpdateInternal (float deltaTime)
 registers a ContactJointHandler if no handler node was registered

Protected Attributes

dGeomID mODEGeom
 the ode collision geometry

Detailed Description

ODE geometry object- geom for short.

Geoms are the fundamental objects in the collision system. They represent a single rigid shape as for example a sphere or a box. A special kind of geom called 'space' can represent a group of other geoms. A placeable geom can be associated with rigid body objects. This allows the collision engine to get the position and orientation of the geoms from the bodies. A body and a geom together represent all the properties of the simulated object.

Definition at line 43 of file collider.h.


Member Enumeration Documentation

enum oxygen::Collider::ECollisionType
 

enumerates the two different collision instances reported to the OnCollision member for each collision reported from ODE.

Enumerator:
CT_DIRECT  the collision pair as reported from ODE
CT_SYMMETRIC  the symmetric pair to the pair reported from ODE

Definition at line 52 of file collider.h.


Constructor & Destructor Documentation

Collider::Collider  ) 
 

Definition at line 33 of file collider.cpp.

Collider::~Collider  )  [virtual]
 

Definition at line 37 of file collider.cpp.

References mODEGeom.


Member Function Documentation

bool Collider::AddCollisionHandler const std::string &  handlerName  ) 
 

registers a new collision handler to this collider.

If no collision handler is registered until the first call to OnCollision a ContactJointHandler is automatically registered.

Parameters:
handlerName is the class name of the CollisionHandler

Definition at line 123 of file collider.cpp.

References zeitgeist::Node::AddChildReference(), zeitgeist::Object::GetCore(), and zeitgeist::Object::GetLog().

Referenced by PrePhysicsUpdateInternal().

Here is the call graph for this function:

shared_ptr< Collider > Collider::GetCollider dGeomID  id  )  [static]
 

returns the Collider corresponding to the given ODE geom

Definition at line 169 of file collider.cpp.

References zeitgeist::Object::GetSelf().

Referenced by oxygen::Space::HandleCollide().

Here is the call graph for this function:

dGeomID Collider::GetODEGeom  ) 
 

returns the ID of managed ODE geom

Definition at line 118 of file collider.cpp.

References mODEGeom.

bool Collider::Intersects boost::shared_ptr< Collider collider  ) 
 

returns true if the ODE geom managed by this Collider intersects with the geom managed by the given collider

Definition at line 213 of file collider.cpp.

References mODEGeom.

void Collider::OnCollision boost::shared_ptr< Collider collidee,
dContact &  contact,
ECollisionType  type
[virtual]
 

notifies the Collider that a collision with another geometry object has occured.

It is called from Space::HandleCollide. For the effects of a collision to be considered in the further simulation the Collider has to construct an ODE contact joint between the bodies associated to the affected geoms. This task among others is delegated to a set of CollisionHandler objects registered to a Collider.

Parameters:
collidee is the geom ID of the collision partner
holds the contact points between the two affected geoms as returned from ODE dCollide function
symmetric indicates tha this collision indicates a symmetric case

Definition at line 141 of file collider.cpp.

References CT_SYMMETRIC.

void Collider::OnLink  )  [protected, virtual]
 

registers the managed geom to the Space of the Scene and to the associated ODE body

Reimplemented from zeitgeist::Leaf.

Definition at line 46 of file collider.cpp.

References zeitgeist::Leaf::GetParent(), oxygen::ODEObject::GetSpaceID(), oxygen::BaseNode::GetWorldTransform(), mODEGeom, zeitgeist::Leaf::OnLink(), SetPosition(), and SetRotation().

Here is the call graph for this function:

void Collider::OnUnlink  )  [protected, virtual]
 

unregisters the managed geom from the Space of the Scene.

The geom is removed from the body later within the destructor.

Reimplemented from zeitgeist::Leaf.

Definition at line 82 of file collider.cpp.

References oxygen::ODEObject::GetSpaceID(), mODEGeom, and zeitgeist::Leaf::OnUnlink().

Here is the call graph for this function:

void Collider::PrePhysicsUpdateInternal float  deltaTime  )  [protected, virtual]
 

registers a ContactJointHandler if no handler node was registered

Reimplemented from oxygen::BaseNode.

Definition at line 106 of file collider.cpp.

References AddCollisionHandler(), and zeitgeist::Node::GetChildSupportingClass().

Here is the call graph for this function:

void Collider::SetPosition const salt::Vector3f pos  )  [virtual]
 

sets the relative position of the managed geom directly.

If the geom is connected to a body, the position of the body will also be changed

Reimplemented in oxygen::PlaneCollider.

Definition at line 207 of file collider.cpp.

References oxygen::BaseNode::GetWorldTransform(), and mODEGeom.

Referenced by OnLink().

Here is the call graph for this function:

void Collider::SetRotation const salt::Matrix rot  )  [virtual]
 

sets the relative orientation of the managed geom directly.

If the geom is connected to a body, the orientation of the body will also be changed

Reimplemented in oxygen::PlaneCollider.

Definition at line 200 of file collider.cpp.

References oxygen::ODEObject::ConvertRotationMatrix(), and mODEGeom.

Referenced by OnLink().

Here is the call graph for this function:


Member Data Documentation

dGeomID oxygen::Collider::mODEGeom [protected]
 

the ode collision geometry

Definition at line 136 of file collider.h.

Referenced by oxygen::SphereCollider::ConstructInternal(), oxygen::RayCollider::ConstructInternal(), oxygen::PlaneCollider::ConstructInternal(), oxygen::CCylinderCollider::ConstructInternal(), oxygen::BoxCollider::ConstructInternal(), oxygen::BoxCollider::GetBoxLengths(), GetODEGeom(), oxygen::CCylinderCollider::GetParams(), oxygen::SphereCollider::GetPointDepth(), oxygen::PlaneCollider::GetPointDepth(), oxygen::CCylinderCollider::GetPointDepth(), oxygen::BoxCollider::GetPointDepth(), oxygen::SphereCollider::GetRadius(), Intersects(), OnLink(), OnUnlink(), oxygen::BoxCollider::SetBoxLengths(), oxygen::RayCollider::SetParams(), oxygen::PlaneCollider::SetParams(), oxygen::CCylinderCollider::SetParams(), SetPosition(), oxygen::SphereCollider::SetRadius(), SetRotation(), and ~Collider().


The documentation for this class was generated from the following files:
Generated on Thu Apr 6 15:45:26 2006 for rcssserver3d by  doxygen 1.4.4