Public Types | Public Member Functions | Protected Member Functions

deCollider Class Reference

World Collider Object. More...

#include <deCollider.h>

Inheritance diagram for deCollider:
deResource deObject deColliderComponent deColliderRigged deColliderVolume

List of all members.

Public Types

enum  eResponseType { ertStatic, ertDynamic, ertKinematic }
 

Collision Response Types.

More...

Public Member Functions

void pNotifyBoneAngularVelocityChanged (int index)
void pNotifyBoneDynamicChanged (int index)
void pNotifyBoneLinearVelocityChanged (int index)
void pNotifyBoneOrientationChanged (int index)
void pNotifyBonePositionChanged (int index)
void pNotifyBonePropertiesChanged (int index)
Constructors and Destructors
 deCollider (deColliderManager *manager)
 Creates a new collider object with the given resource manager.
virtual ~deCollider ()
 Cleans up the collider.
Management
deWorldGetParentWorld () const
 Retrieves the parent world or NULL if not in a world.
void SetParentWorld (deWorld *parentWorld)
 Sets the parent world or NULL if not in a world.
const decDVectorGetPosition () const
 Retrieves the position which is the central mass point.
void SetPosition (const decDVector &position)
 Sets the position which is the central mass point.
const decQuaternionGetOrientation () const
 Retrieves the orientation.
void SetOrientation (const decQuaternion &orientation)
 Sets the orientation.
const decVectorGetLinearVelocity () const
 Retrieves the linear velocity in m/s.
void SetLinearVelocity (const decVector &linVelo)
 Sets the linear velocity in m/s.
const decVectorGetAngularVelocity () const
 Retrieves the angular velocity in degree/s.
void SetAngularVelocity (const decVector &angVelo)
 Sets the angular velocity in degree/s.
float GetMass () const
 Retrieves the mass in kg.
void SetMass (float mass)
 Sets the mass in kg.
const decVectorGetGravity () const
 Retrieves the gravity in m/s^2.
void SetGravity (const decVector &gravity)
 Sets the gravity in m/s^2.
bool GetEnabled () const
 Determines if this collider is enabled.
void SetEnabled (bool enabled)
 Sets if this collider is enabled.
int GetResponseType () const
 Retrieves the Collision Response Type.
void SetResponseType (int responseType)
 Sets the Collision Response Type.
bool GetUseLocalGravity () const
 Determines if the local gravity has to be used instead of the world gravity.
void SetUseLocalGravity (bool useLocalGravity)
 Sets if the local gravity has to be used instead of the world gravity.
decLayerMaskGetLayerMask ()
 Retrieves the layer mask.
void NotifyLayerMaskChanged ()
 Notifies the peers that the layer mask changed.
int GetGroupNumber () const
 Retrieves the group number or 0 if not set.
void SetGroupNumber (int groupNumber)
 Sets the group number or 0 if not set.
bool CanHitCollider (const deCollider &collider) const
 Determines if this collider can hit another collider.
bool CanHit (const decLayerMask &layerMask, int groupNumber) const
 Determines if this collider can hit another object represented by a layer mask and a group number.
Forces
void ApplyForce (const decVector &force)
 Applies a force at the center mass point.
void ApplyForceAt (const decVector &force, const decVector &point)
 Applies a force relative to the collider position.
void ApplyTorque (const decVector &torque)
 Applies a torque force at the center mass point.
Attachments
int GetAttachmentCount () const
 Retrieves the count of attachments.
deColliderAttachmentGetAttachmentAt (int index) const
 Retrieves the indexed attachment.
bool HasAttachmentWith (deCollider *collider) const
 Determines if the given collider is already attached.
deColliderAttachmentGetAttachmentWith (deCollider *collider) const
 Retrieves the attachment with the given collider or null if not found.
void AddAttachment (deColliderAttachment *attachment)
 Adds a new attachment.
void RemoveAttachment (deColliderAttachment *attachment)
 Removes an attachment.
void RemoveAllAttachments ()
 Removes all attachments.
void NotifyAttachmentChanged (int index)
 Notifies that an attachment has changed.
Constraints
int GetConstraintCount () const
 Retrieves the count of constraints.
deColliderConstraintGetConstraintAt (int index) const
 Retrieves the indexed constraint.
int IndexOfConstraint (deColliderConstraint *constraint) const
 Retrieves the index of the given constraint or -1 if not found.
bool HasConstraint (deColliderConstraint *constraint) const
 Determines if the given constraint exists.
void AddConstraint (deColliderConstraint *constraint)
 Adds a new constraint.
void RemoveConstraint (deColliderConstraint *constraint)
 Removes a constraint.
void RemoveAllConstraints ()
 Removes all constraints.
void NotifyConstraintChanged (int index)
 Notifies that an constraint has changed.
System Peers
deBasePhysicsColliderGetPhysicsCollider () const
 Retrieves the physics system peer object.
void SetPhysicsCollider (deBasePhysicsCollider *phyCollider)
 Sets the physics system peer object.
deBaseScriptingColliderGetScriptingCollider () const
 Retrieves the scripting system peer object.
void SetScriptingCollider (deBaseScriptingCollider *scrCollider)
 Sets the scripting system peer object.
Visiting
virtual void Visit (deColliderVisitor *visitor)
 Visits the collider.

Protected Member Functions

void pNotifyCollisionVolumeChanged ()
void pNotifyComponentChanged ()
void pNotifyRigChanged ()

Detailed Description

World Collider Object.

Colliders are used by the physics module to provide collision detection and optional collision response. After the collision detection stage is done each Collider contains the new state of motion. The user can then update the game state depending on the changes. The scripting peer receives all relevant events during a collision detection run. A Collider can be defined as a couple of different types.

The Collider object itself can not be constructed. Create a new Collider object using one of deColliderVolume, deColliderRigged or deColliderComponent classes.

Collision Response Types
The Collision Response Type determines how a collision is handeled once detected.

ertNone causes no response to be send and hence does not notify you about a collision. This is used for static objects that only act as blockers or objects that do not wish to generate collision notification because they are activated by other objects.

ertPhysics causes a physical response to be calculated by the Physics Module. The Scripting Module is notified using its peer about the collision. You are responsible there to provide informations about the surfaces getting in contact to allow the Physics Module to calculate a proper physical reaction to the collision.

ertCustom is used to generate your own collision responses. Upon collision the Scripting Module is notified. In the CollisionResponse function you are responsible for specifying the effect of the collision on the object.

Author:
Plüss Roland
Version:
1.0
Date:
2008

Member Enumeration Documentation

Collision Response Types.

Enumerator:
ertStatic 

Static, same as no response.

ertDynamic 

Dynamic, same as physics response.

ertKinematic 

Kinematic, same as custom response.


Constructor & Destructor Documentation

deCollider::deCollider ( deColliderManager manager )

Creates a new collider object with the given resource manager.

virtual deCollider::~deCollider (  ) [virtual]

Cleans up the collider.


Member Function Documentation

void deCollider::AddAttachment ( deColliderAttachment attachment )

Adds a new attachment.

A collider can only be attached once. Trying to attach a collider with two different attachments results in an exception.

void deCollider::AddConstraint ( deColliderConstraint constraint )

Adds a new constraint.

void deCollider::ApplyForce ( const decVector force )

Applies a force at the center mass point.

void deCollider::ApplyForceAt ( const decVector force,
const decVector point 
)

Applies a force relative to the collider position.

void deCollider::ApplyTorque ( const decVector torque )

Applies a torque force at the center mass point.

bool deCollider::CanHit ( const decLayerMask layerMask,
int  groupNumber 
) const

Determines if this collider can hit another object represented by a layer mask and a group number.

The layer mask and the group number of both entities are checked for a match. Group numbers match only if neither of them is 0.

Parameters:
layerMaskLayer mask to test against.
groupNumberGroup number to test against.
Returns:
true if the collider can collide with this entity.
bool deCollider::CanHitCollider ( const deCollider collider ) const

Determines if this collider can hit another collider.

The layer mask and the group number of both colliders is checked for a match. Group numbers match only if neither of them is 0.

Parameters:
colliderCollider to test for collision with.
Returns:
true if the colliders can collide.
const decVector& deCollider::GetAngularVelocity (  ) const [inline]

Retrieves the angular velocity in degree/s.

deColliderAttachment* deCollider::GetAttachmentAt ( int  index ) const

Retrieves the indexed attachment.

int deCollider::GetAttachmentCount (  ) const [inline]

Retrieves the count of attachments.

deColliderAttachment* deCollider::GetAttachmentWith ( deCollider collider ) const

Retrieves the attachment with the given collider or null if not found.

deColliderConstraint* deCollider::GetConstraintAt ( int  index ) const

Retrieves the indexed constraint.

int deCollider::GetConstraintCount (  ) const [inline]

Retrieves the count of constraints.

bool deCollider::GetEnabled (  ) const [inline]

Determines if this collider is enabled.

Only an enabled collider takes part in collision detection and response.

const decVector& deCollider::GetGravity (  ) const [inline]

Retrieves the gravity in m/s^2.

int deCollider::GetGroupNumber (  ) const [inline]

Retrieves the group number or 0 if not set.

Returns:
group number or 0.
decLayerMask& deCollider::GetLayerMask (  ) [inline]

Retrieves the layer mask.

Call NotifyLayerMaskChanged after you have changed this object.

Returns:
layer mask.
const decVector& deCollider::GetLinearVelocity (  ) const [inline]

Retrieves the linear velocity in m/s.

float deCollider::GetMass (  ) const [inline]

Retrieves the mass in kg.

const decQuaternion& deCollider::GetOrientation (  ) const [inline]

Retrieves the orientation.

deWorld* deCollider::GetParentWorld (  ) const [inline]

Retrieves the parent world or NULL if not in a world.

deBasePhysicsCollider* deCollider::GetPhysicsCollider (  ) const [inline]

Retrieves the physics system peer object.

const decDVector& deCollider::GetPosition (  ) const [inline]

Retrieves the position which is the central mass point.

int deCollider::GetResponseType (  ) const [inline]

Retrieves the Collision Response Type.

deBaseScriptingCollider* deCollider::GetScriptingCollider (  ) const [inline]

Retrieves the scripting system peer object.

bool deCollider::GetUseLocalGravity (  ) const [inline]

Determines if the local gravity has to be used instead of the world gravity.

bool deCollider::HasAttachmentWith ( deCollider collider ) const

Determines if the given collider is already attached.

bool deCollider::HasConstraint ( deColliderConstraint constraint ) const

Determines if the given constraint exists.

int deCollider::IndexOfConstraint ( deColliderConstraint constraint ) const

Retrieves the index of the given constraint or -1 if not found.

void deCollider::NotifyAttachmentChanged ( int  index )

Notifies that an attachment has changed.

You have to call this explicitly if you changed something on an attachment.

void deCollider::NotifyConstraintChanged ( int  index )

Notifies that an constraint has changed.

You have to call this explicitly if you changed something on an constraint.

void deCollider::NotifyLayerMaskChanged (  )

Notifies the peers that the layer mask changed.

void deCollider::pNotifyBoneAngularVelocityChanged ( int  index )
void deCollider::pNotifyBoneDynamicChanged ( int  index )
void deCollider::pNotifyBoneLinearVelocityChanged ( int  index )
void deCollider::pNotifyBoneOrientationChanged ( int  index )
void deCollider::pNotifyBonePositionChanged ( int  index )
void deCollider::pNotifyBonePropertiesChanged ( int  index )
void deCollider::pNotifyCollisionVolumeChanged (  ) [protected]
void deCollider::pNotifyComponentChanged (  ) [protected]
void deCollider::pNotifyRigChanged (  ) [protected]
void deCollider::RemoveAllAttachments (  )

Removes all attachments.

void deCollider::RemoveAllConstraints (  )

Removes all constraints.

void deCollider::RemoveAttachment ( deColliderAttachment attachment )

Removes an attachment.

void deCollider::RemoveConstraint ( deColliderConstraint constraint )

Removes a constraint.

void deCollider::SetAngularVelocity ( const decVector angVelo )

Sets the angular velocity in degree/s.

void deCollider::SetEnabled ( bool  enabled )

Sets if this collider is enabled.

Only an enabled collider takes part in collision detection and response.

void deCollider::SetGravity ( const decVector gravity )

Sets the gravity in m/s^2.

void deCollider::SetGroupNumber ( int  groupNumber )

Sets the group number or 0 if not set.

Parameters:
groupNumberGroup number or 0.
void deCollider::SetLinearVelocity ( const decVector linVelo )

Sets the linear velocity in m/s.

void deCollider::SetMass ( float  mass )

Sets the mass in kg.

void deCollider::SetOrientation ( const decQuaternion orientation )

Sets the orientation.

void deCollider::SetParentWorld ( deWorld parentWorld )

Sets the parent world or NULL if not in a world.

This function is called by the world object itself. Do not call it on your own.

void deCollider::SetPhysicsCollider ( deBasePhysicsCollider phyCollider )

Sets the physics system peer object.

void deCollider::SetPosition ( const decDVector position )

Sets the position which is the central mass point.

void deCollider::SetResponseType ( int  responseType )

Sets the Collision Response Type.

void deCollider::SetScriptingCollider ( deBaseScriptingCollider scrCollider )

Sets the scripting system peer object.

void deCollider::SetUseLocalGravity ( bool  useLocalGravity )

Sets if the local gravity has to be used instead of the world gravity.

virtual void deCollider::Visit ( deColliderVisitor visitor ) [virtual]

Visits the collider.

Reimplemented in deColliderComponent, deColliderRigged, and deColliderVolume.


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