Drag[en]gine Game Engine  1.0
deColliderRig Class Reference

Rig collider. More...

#include <deColliderRig.h>

Inheritance diagram for deColliderRig:
deCollider deResource deObject deColliderComponent

Public Member Functions

Management
deRigGetRig () const
 Rig or NULL if not set. More...
 
void SetRig (deRig *rig)
 Set rig or NULL if not set. More...
 
int GetBoneCount () const
 Number of bones. More...
 
deColliderBoneGetBoneAt (int index) const
 Bone at index. More...
 
void CopyStatesFromColliderRig (const deColliderRig &collider)
 Copy bone states from another rig collider bones if set. More...
 
void CopyStateFromColliderRig (int bone, const deColliderRig &collider)
 Copy a bone state from a collider rig bone if set. More...
 
void CopyStateFromColliderRig (int boneFrom, int boneTo, const deColliderRig &collider)
 Copy a bone state from a collider rig bone if set. More...
 
void EnableBoneConstraint (int bone, int constraint, bool enable)
 Enable or disable a bone constraint. More...
 
void ReplaceBoneConstraint (int bone, int constraint, const deRigConstraint &replacement)
 Replace a bone constraint. More...
 
Force and Impuls
void ApplyBoneImpuls (int bone, const decVector &impuls)
 Apply impuls at center mass point of bone. More...
 
void ApplyBoneImpulsAt (int bone, const decVector &impuls, const decVector &point)
 Apply impuls relative to bone position. More...
 
void ApplyBoneTorqueImpuls (int bone, const decVector &torqueImpuls)
 Apply torque impuls at center mass point of bone. More...
 
void ApplyBoneForce (int bone, const decVector &force)
 Apply force at center mass point of bone. More...
 
void ApplyBoneForceAt (int bone, const decVector &force, const decVector &point)
 Apply force relative to bone position. More...
 
void ApplyBoneTorque (int bone, const decVector &torque)
 Apply torque force at center mass point of bone. More...
 
Visiting
virtual void Visit (deColliderVisitor &visitor)
 Visit the collider. More...
 
- Public Member Functions inherited from deCollider
void pNotifyBoneAngularVelocityChanged (int index)
 
void pNotifyBoneDynamicChanged (int index)
 
void pNotifyBoneLinearVelocityChanged (int index)
 
void pNotifyBoneOrientationChanged (int index)
 
void pNotifyBonePositionChanged (int index)
 
void pNotifyBonePropertiesChanged (int index)
 
const decDVectorGetPosition () const
 Central mass point position. More...
 
void SetPosition (const decDVector &position)
 Set central mass point position. More...
 
const decQuaternionGetOrientation () const
 Orientation. More...
 
void SetOrientation (const decQuaternion &orientation)
 Set orientation. More...
 
const decVectorGetScale () const
 Scale. More...
 
void SetScale (const decVector &scale)
 Set scale. More...
 
const decVectorGetLinearVelocity () const
 Linear velocity in m/s. More...
 
void SetLinearVelocity (const decVector &linVelo)
 Set linear velocity in m/s. More...
 
const decVectorGetAngularVelocity () const
 Angular velocity in degree/s. More...
 
void SetAngularVelocity (const decVector &angVelo)
 Set angular velocity in degree/s. More...
 
float GetMass () const
 Mass in kg. More...
 
void SetMass (float mass)
 Set mass in kg. More...
 
const decVectorGetGravity () const
 Gravity in m/s^2. More...
 
void SetGravity (const decVector &gravity)
 Set gravity in m/s^2. More...
 
bool GetEnabled () const
 Collider is enabled. More...
 
void SetEnabled (bool enabled)
 Set if collider is enabled. More...
 
eResponseType GetResponseType () const
 Collision response type. More...
 
void SetResponseType (eResponseType responseType)
 Set Collision response type. More...
 
bool GetUseLocalGravity () const
 Use local gravity instead of the world gravity. More...
 
void SetUseLocalGravity (bool useLocalGravity)
 Set if local gravity is used instead of the world gravity. More...
 
float GetForceFieldDirect () const
 Factor for direct type force fields. More...
 
void SetForceFieldDirect (float factor)
 Set factor for direct type force fields. More...
 
float GetForceFieldSurface () const
 Factor for surface type force fields. More...
 
void SetForceFieldSurface (float factor)
 Set factor for surface type force fields. More...
 
float GetForceFieldMass () const
 Factor for mass type force fields. More...
 
void SetForceFieldMass (float factor)
 Set factor for mass type force fields. More...
 
float GetForceFieldSpeed () const
 Factor for speed type force fields. More...
 
void SetForceFieldSpeed (float factor)
 Set factor for speed type force fields. More...
 
const decCollisionFilterGetCollisionFilter () const
 Collision filter. More...
 
void SetCollisionFilter (const decCollisionFilter &filter)
 Set collision filter. More...
 
void ApplyImpuls (const decVector &impuls)
 Apply impuls at the center mass point. More...
 
void ApplyImpulsAt (const decVector &impuls, const decVector &point)
 Apply impuls relative to the collider position. More...
 
void ApplyTorqueImpuls (const decVector &torqueImpuls)
 Apply torque impuls at the center mass point. More...
 
void ApplyForce (const decVector &force)
 Apply force at the center mass point. More...
 
void ApplyForceAt (const decVector &force, const decVector &point)
 Apply force relative to the collider position. More...
 
void ApplyTorque (const decVector &torque)
 Apply torque force at the center mass point. More...
 
int GetAttachmentCount () const
 Number of attachments. More...
 
deColliderAttachmentGetAttachmentAt (int index) const
 Attachment at index. More...
 
bool HasAttachmentWith (deResource *resource) const
 Resource is attached. More...
 
deColliderAttachmentGetAttachmentWith (deResource *resource) const
 Attachment with resource or null if not attached. More...
 
void AddAttachment (deColliderAttachment *attachment)
 Add attachment. More...
 
void RemoveAttachment (deColliderAttachment *attachment)
 Remove attachment. More...
 
void RemoveAllAttachments ()
 Remove all attachments. More...
 
void NotifyAttachmentChanged (int index)
 Notify peers attachment changed. More...
 
void AttachmentsForceUpdate ()
 Force update of all attachments. More...
 
int GetConstraintCount () const
 Number of constraints. More...
 
deColliderConstraintGetConstraintAt (int index) const
 Constraint at index. More...
 
int IndexOfConstraint (deColliderConstraint *constraint) const
 Index of constraint or -1 if absent. More...
 
bool HasConstraint (deColliderConstraint *constraint) const
 Constraint is present. More...
 
void AddConstraint (deColliderConstraint *constraint)
 Add constraint. More...
 
void RemoveConstraint (deColliderConstraint *constraint)
 Remove constraint. More...
 
void RemoveAllConstraints ()
 Remove all constraints. More...
 
void NotifyConstraintChanged (int index)
 Notify peers constraint has changed. More...
 
int GetIgnoreColliderCount () const
 Number of colliders to ignore. More...
 
deColliderGetIgnoreColliderAt (int index) const
 Collider to ignore at index. More...
 
bool HasIgnoreCollider (deCollider *collider) const
 Collider to ignore is present. More...
 
void AddIgnoreCollider (deCollider *collider)
 Add collider to ignore. More...
 
void RemoveIgnoreCollider (deCollider *collider)
 Remove collider to ignore. More...
 
void RemoveAllIgnoreColliders ()
 Remove all colliders to ignore. More...
 
int GetCollisionTestCount () const
 Number of post physics collision tests. More...
 
deColliderCollisionTestGetCollisionTestAt (int index) const
 Post physics collision test at index. More...
 
int IndexOfCollisionTest (deColliderCollisionTest *collisionTest) const
 Index of post physics collision test or -1 if not found. More...
 
bool HasCollisionTest (deColliderCollisionTest *collisionTest) const
 Post physics collision test is present. More...
 
void AddCollisionTest (deColliderCollisionTest *collisionTest)
 Adds post physics collision test. More...
 
void RemoveCollisionTest (deColliderCollisionTest *collisionTest)
 Remove post physics collision test. More...
 
void RemoveAllCollisionTests ()
 Remove all post physics collision tests. More...
 
void NotifyCollisionTestChanged (int index)
 Notify peers a post physics collision test changed. More...
 
void NotifyCollisionTestEnableChanged (int index)
 Notify peers a post physics collision test enabled or disabled. More...
 
bool PointInside (const decDVector &point)
 Test if a point is located inside the collider. More...
 
void RayHits (const decDVector &rayOrigin, const decVector &rayDirection, deBaseScriptingCollider *listener)
 Test ray for collision with the collider. More...
 
void ColliderHits (deCollider *collider, deBaseScriptingCollider *listener)
 Test collider for collision with collider. More...
 
void ColliderMoveHits (deCollider *collider, const decVector &displacement, deBaseScriptingCollider *listener)
 Test moving collider for collision with collider. More...
 
void ColliderRotateHits (deCollider *collider, const decVector &rotation, deBaseScriptingCollider *listener)
 Test rotating collider for collision with collider. More...
 
void ColliderMoveRotateHits (deCollider *collider, const decVector &displacement, const decVector &rotation, deBaseScriptingCollider *listener)
 Test moving and rotating collider for collision with collider. More...
 
deBasePhysicsColliderGetPhysicsCollider () const
 Physics system peer. More...
 
void SetPhysicsCollider (deBasePhysicsCollider *phyCollider)
 Set physics system peer. More...
 
deBaseScriptingColliderGetScriptingCollider () const
 Scripting system peer. More...
 
void SetScriptingCollider (deBaseScriptingCollider *scrCollider)
 Set scripting system peer. More...
 
deWorldGetParentWorld () const
 Parent world or NULL. More...
 
void SetParentWorld (deWorld *world)
 Set parent world or NULL. More...
 
deColliderGetLLWorldPrev () const
 Previous collider in the parent world linked list. More...
 
void SetLLWorldPrev (deCollider *collider)
 Set next collider in the parent world linked list. More...
 
deColliderGetLLWorldNext () const
 Next collider in the parent world linked list. More...
 
void SetLLWorldNext (deCollider *collider)
 Set next collider in the parent world linked list. More...
 
 deCollider (deColliderManager *manager)
 Create collider. More...
 
- Public Member Functions inherited from deResource
deResourceManagerGetResourceManager () const
 Resource manager or NULL if resource is leaking. More...
 
deEngineGetEngine () const
 Game engine object from resource manager. More...
 
deResourceGetLLManagerPrev () const
 Previous resource in the resource manager linked list. More...
 
void SetLLManagerPrev (deResource *resource)
 Set next resource in the resource manager linked list. More...
 
deResourceGetLLManagerNext () const
 Next resource in the resource manager linked list. More...
 
void SetLLManagerNext (deResource *resource)
 Set next resource in the resource manager linked list. More...
 
void MarkLeaking ()
 Marks the resource leaking. More...
 
 deResource (deResourceManager *resourceManager)
 Create resource. More...
 
- Public Member Functions inherited from deObject
int GetRefCount () const
 Reference count. More...
 
void AddReference ()
 Add reference increasing reference count by 1. More...
 
void FreeReference ()
 Decrease reference count by one and delete object if count reaches 0. More...
 
 deObject ()
 Create object with reference count of 1. More...
 

Constructors and Destructors

 deColliderRig (deColliderManager *manager)
 Create rig collider. More...
 
virtual ~deColliderRig ()
 Clean up rig collider. More...
 

Additional Inherited Members

- Public Types inherited from deCollider
enum  eResponseType { ertStatic, ertDynamic, ertKinematic }
 Collision Response Types. More...
 
- Protected Member Functions inherited from deCollider
void pNotifyCollisionVolumeChanged ()
 
void pNotifyComponentChanged ()
 
void pNotifyRigChanged ()
 
virtual ~deCollider ()
 Clean up collider. More...
 
- Protected Member Functions inherited from deResource
virtual ~deResource ()
 Clean up resource. More...
 
- Protected Member Functions inherited from deObject
virtual ~deObject ()
 Clean up object. More...
 

Detailed Description

Rig collider.

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. The Collider is defined by a Rig object. The Rig object contains a list of bones. Each bone is defined by a Collision Volume and additional physical properties. Each bone is considered to be one single collision body able to collide with all other bones in the rig except the direct parent bone.

Author
Pl├╝ss Roland
Version
1.0
Date
2015

Constructor & Destructor Documentation

◆ deColliderRig()

deColliderRig::deColliderRig ( deColliderManager manager)

Create rig collider.

◆ ~deColliderRig()

virtual deColliderRig::~deColliderRig ( )
protectedvirtual

Clean up rig collider.

Note
Subclasses should set their destructor protected too to avoid users accidently deleting a reference counted object through the object pointer. Only FreeReference() is allowed to delete the object.

Member Function Documentation

◆ ApplyBoneForce()

void deColliderRig::ApplyBoneForce ( int  bone,
const decVector force 
)

Apply force at center mass point of bone.

This affects the total force and torque applied during the next debpWorld::DetectCollision only. Useful to apply continuous forces on an object. Has to be called every frame update.

Exceptions
deeOutOfBoundaryindex is less than 0 or greater than or equal to GetBoneCount().

Referenced by GetBoneCount().

◆ ApplyBoneForceAt()

void deColliderRig::ApplyBoneForceAt ( int  bone,
const decVector force,
const decVector point 
)

Apply force relative to bone position.

This affects the total force and torque applied during the next debpWorld::DetectCollision only. Useful to apply continuous forces on an object. Has to be called every frame update.

Exceptions
deeOutOfBoundaryindex is less than 0 or greater than or equal to GetBoneCount().

Referenced by GetBoneCount().

◆ ApplyBoneImpuls()

void deColliderRig::ApplyBoneImpuls ( int  bone,
const decVector impuls 
)

Apply impuls at center mass point of bone.

This affects linear and angular velocity. This is the best way way to apply impacts.

Exceptions
deeOutOfBoundaryindex is less than 0 or greater than or equal to GetBoneCount().

Referenced by GetBoneCount().

◆ ApplyBoneImpulsAt()

void deColliderRig::ApplyBoneImpulsAt ( int  bone,
const decVector impuls,
const decVector point 
)

Apply impuls relative to bone position.

This affects linear and angular velocity. This is the best way way to apply impacts.

Exceptions
deeOutOfBoundaryindex is less than 0 or greater than or equal to GetBoneCount().

Referenced by GetBoneCount().

◆ ApplyBoneTorque()

void deColliderRig::ApplyBoneTorque ( int  bone,
const decVector torque 
)

Apply torque force at center mass point of bone.

This affects the total torque applied during the next debpWorld::DetectCollision only. Useful to apply continuous forces on an object. Has to be called every frame update.

Exceptions
deeOutOfBoundaryindex is less than 0 or greater than or equal to GetBoneCount().

Referenced by GetBoneCount().

◆ ApplyBoneTorqueImpuls()

void deColliderRig::ApplyBoneTorqueImpuls ( int  bone,
const decVector torqueImpuls 
)

Apply torque impuls at center mass point of bone.

This affects angular velocity. This is the best way way to apply impacts.

Exceptions
deeOutOfBoundaryindex is less than 0 or greater than or equal to GetBoneCount().

Referenced by GetBoneCount().

◆ CopyStateFromColliderRig() [1/2]

void deColliderRig::CopyStateFromColliderRig ( int  bone,
const deColliderRig collider 
)

Copy a bone state from a collider rig bone if set.

The rigs do not have to match. Only if matching the bone state is copied.

Referenced by GetBoneCount().

◆ CopyStateFromColliderRig() [2/2]

void deColliderRig::CopyStateFromColliderRig ( int  boneFrom,
int  boneTo,
const deColliderRig collider 
)

Copy a bone state from a collider rig bone if set.

The rigs do not have to match. Allows to copy staes between arbitrary bones.

◆ CopyStatesFromColliderRig()

void deColliderRig::CopyStatesFromColliderRig ( const deColliderRig collider)

Copy bone states from another rig collider bones if set.

The rigs do not have to match. Only matching bones are copied.

Referenced by GetBoneCount().

◆ EnableBoneConstraint()

void deColliderRig::EnableBoneConstraint ( int  bone,
int  constraint,
bool  enable 
)

Enable or disable a bone constraint.

Referenced by GetBoneCount().

◆ GetBoneAt()

deColliderBone& deColliderRig::GetBoneAt ( int  index) const

Bone at index.

Exceptions
deeOutOfBoundaryindex is less than 0 or greater than or equal to GetBoneCount().

Referenced by GetBoneCount().

◆ GetBoneCount()

◆ GetRig()

deRig* deColliderRig::GetRig ( ) const
inline

Rig or NULL if not set.

References SetRig().

◆ ReplaceBoneConstraint()

void deColliderRig::ReplaceBoneConstraint ( int  bone,
int  constraint,
const deRigConstraint replacement 
)

Replace a bone constraint.

The provided rig constraint only serves as source to copy the new parameters. It has to be freed by the called afterwards.

Referenced by GetBoneCount().

◆ SetRig()

void deColliderRig::SetRig ( deRig rig)

Set rig or NULL if not set.

Referenced by GetRig().

◆ Visit()

virtual void deColliderRig::Visit ( deColliderVisitor visitor)
virtual

Visit the collider.

Reimplemented from deCollider.

Reimplemented in deColliderComponent.

Referenced by GetBoneCount().


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