#include <collisionhandler.h>
Inheritance diagram for oxygen::CollisionHandler:
Public Member Functions | |
CollisionHandler () | |
virtual | ~CollisionHandler () |
virtual void | HandleCollision (boost::shared_ptr< Collider > collidee, dContact &contact)=0 |
HandleCollision is called from the Collider to which this CollisionHandler is registered to. | |
virtual bool | IsSymmetricHandler () |
returns true if a class of CollisionHandlers wants to handle both- a collision and it's symmetric counterpart. | |
Protected Member Functions | |
virtual void | OnLink () |
This method is called, when the hierarchy object has been linked to a parent. | |
virtual void | OnUnlink () |
This rountine is called, before the hierarchy object is removed from the parent. | |
Protected Attributes | |
boost::shared_ptr< Collider > | mCollider |
the collider this CollisionHandler is associated with | |
boost::shared_ptr< World > | mWorld |
the world this CollisionHandler is associated with | |
boost::shared_ptr< Space > | mSpace |
the space this CollisionHandler is associated with |
To each Collider instance one ore more CollisionHandlers are registered. When the collision system detects a collision between two geoms the HandleCollision() method of each registered CollisionHandler is called. An example implementation is the derived ContactJoint class that constructs an ODE contact joint, covering the most common response to a collision.
Definition at line 43 of file collisionhandler.h.
|
Definition at line 49 of file collisionhandler.h. |
|
Definition at line 50 of file collisionhandler.h. |
|
HandleCollision is called from the Collider to which this CollisionHandler is registered to. Derived classes implement this callback to react in response to a collision.
Implemented in oxygen::ContactJointHandler, oxygen::RecorderHandler, and PerceptorHandler. |
|
returns true if a class of CollisionHandlers wants to handle both- a collision and it's symmetric counterpart. ODE reports us the set of colliding geoms, for example {(a,b),(b,c)} for two collisions between three involved geoms a,b and c. For each collision two symmetric pairs exist, for example (a,b) and (b,a). ODE consideres both equal and only reports one of them. For the first pair (a,b) of the example above the CollisionHandlers of a are notified about the collision with b. In the symmetric case (b,a) the CollisionHandlers of b are notified about the collision with a. For some CollisionHandler, e.g. the ContactJointHandler this behaviour is fine, as it is required to create exactly one contact joint between the two colliding geoms. This can be done by either one of the two involved CollisionHandlers. Therefore the ContactJointHandler is not a symmetric handler. For other CollisionHandlers, e.g. the CollisionRecorder this behaviour does not suffice and both CollisionHandlers must be notified if a collision occurs as both involved colliders want to record a collision as it happens. In any case the collision should be reported to both CollisionHandlers. The CollisionRecorder therefore is a symmetric handler. The default implementation returns true to indicate a symmetric handler. Reimplemented in oxygen::ContactJointHandler. Definition at line 96 of file collisionhandler.h. |
|
This method is called, when the hierarchy object has been linked to a parent. At that point, traversal can commence. It can be overridden to support custom 'link' behavior. Reimplemented from zeitgeist::Leaf. Definition at line 33 of file collisionhandler.cpp. References zeitgeist::Object::GetLog(), zeitgeist::Leaf::GetParent(), oxygen::BaseNode::GetScene(), mCollider, mSpace, and mWorld. Here is the call graph for this function: ![]() |
|
This rountine is called, before the hierarchy object is removed from the parent. It can be overridden to support custom 'unlink' behavior. Reimplemented from zeitgeist::Leaf. Definition at line 61 of file collisionhandler.cpp. |
|
the collider this CollisionHandler is associated with
Definition at line 107 of file collisionhandler.h. Referenced by OnLink(), and OnUnlink(). |
|
the space this CollisionHandler is associated with
Definition at line 113 of file collisionhandler.h. Referenced by OnLink(), and OnUnlink(). |
|
the world this CollisionHandler is associated with
Definition at line 110 of file collisionhandler.h. Referenced by OnLink(), and OnUnlink(). |