Drag[en]gine Game Engine  1.0
deColliderConstraint Class Reference

Collider Constraint. More...

#include <deColliderConstraint.h>

Public Types

enum  eDegreesOfFreedom {
  edofLinearX, edofLinearY, edofLinearZ, edofAngularX,
  edofAngularY, edofAngularZ
}
 

Public Member Functions

Constructors and Destructors
 deColliderConstraint ()
 
 deColliderConstraint (const deColliderConstraint &constraint)
 Creates a new collider constraint as a copy of another constraint. More...
 
virtual ~deColliderConstraint ()
 
Management
deColliderGetTargetCollider () const
 
void SetTargetCollider (deCollider *collider)
 
const decStringGetTargetBone () const
 
void SetTargetBone (const char *bone)
 
const decVectorGetPosition1 () const
 
void SetPosition1 (const decVector &position)
 
const decQuaternionGetOrientation1 () const
 
void SetOrientation1 (const decQuaternion &orientation)
 
const decVectorGetPosition2 () const
 
void SetPosition2 (const decVector &position)
 
const decQuaternionGetOrientation2 () const
 
void SetOrientation2 (const decQuaternion &orientation)
 
deColliderConstraintDofGetDof (eDegreesOfFreedom dof)
 
const deColliderConstraintDofGetDof (eDegreesOfFreedom dof) const
 
deColliderConstraintDofGetDofLinearX ()
 
const deColliderConstraintDofGetDofLinearX () const
 
deColliderConstraintDofGetDofLinearY ()
 
const deColliderConstraintDofGetDofLinearY () const
 
deColliderConstraintDofGetDofLinearZ ()
 
const deColliderConstraintDofGetDofLinearZ () const
 
deColliderConstraintDofGetDofAngularX ()
 
const deColliderConstraintDofGetDofAngularX () const
 
deColliderConstraintDofGetDofAngularY ()
 
const deColliderConstraintDofGetDofAngularY () const
 
deColliderConstraintDofGetDofAngularZ ()
 
const deColliderConstraintDofGetDofAngularZ () const
 
float GetLinearDamping () const
 
void SetLinearDamping (float damping)
 
float GetAngularDamping () const
 
void SetAngularDamping (float damping)
 
float GetSpringDamping () const
 
void SetSpringDamping (float damping)
 
void LockAll ()
 
void SetToBallJoint ()
 
void SetToHingeJoint (eDegreesOfFreedom degreeOfFreedom, float lowerLimit, float upperLimit)
 
void SetToPistonJoint (eDegreesOfFreedom degreeOfFreedom, float lowerLimit, float upperLimit)
 
void SetSpringLinear1D (eDegreesOfFreedom degreeOfFreedom, float stiffness, float damping, float bendStiffness)
 
bool GetIsRope () const
 
void SetIsRope (bool isRope)
 
float GetBreakingThreshold () const
 Retrieves the breaking impulse threshold or 0 if disabled. More...
 
void SetBreakingThreshold (float impulseThreshold)
 Sets the breaking impulse threshold or 0 to disable. More...
 
int GetBone () const
 
void SetBone (int bone)
 
Operators
deColliderConstraintoperator= (const deColliderConstraint &constraint)
 Set constraint with parameters from another constraint. More...
 

Detailed Description

Collider Constraint.

Defines a constraint for a collider. Constraints can be used for colliders attached or colliders itself. If used on an attachement the attached collider is constraint to the parent collider. If used on a collider it is constraint to the static world. Constraints are defined in a generic way as a 6-Dof ( degreees of freedom ) type constraint. Two coordinate systems are defined for the two constraint partners. Each degree of freedom can be either locked, limited or free. If limited the upper and lower limit can be set. There are three linear and three angular degrees of freedom. The linear degrees of freedom allow the constraint partner to move translational relative to a given major axis whereas the angular degrees of freedom allow rotation about a major axis.

A degree of freedom is considered locked if the upper and lower limit are equal. It is considered free if the upper limit is smaller than the lower limit. In all other cases the degree of freedom is limited.

By default all degrees of freedom are locked.

In addition each degree of freedom can be turned into a spring type degree of freedom. A degree of freedom can be limited or free while being a spring or not. The spring is defined using the constants found in Hooke's Law therefore F=-k*x . The stiffness sprint constant equals to the k constant defining the percentage of the distance stretched away from the equilibrium position applied as force. Hence k is given as [N/m]. The spring damping determines the amount of energy lost over time. A stiffness of 0 disables spring behavior for a given degree of freedom.

A constraint can also be defined as a rope. If the constraint is a rope no collision shape is required on the affected colliders as the constraint itself becomes a rope shape.

A constraint can be set to break if an impulse larger than a threshold value affects the constraint object along a degree of freedom. The physics module is responsible to translate these settings into a useful simulation configuration and can vary. By default a degree of freedom does not break.

Author
Pl├╝ss Roland
Version
1.0
Date
2008

Member Enumeration Documentation

◆ eDegreesOfFreedom

Degrees of freedom.

Enumerator
edofLinearX 

Linear along the X-Axis.

edofLinearY 

Linear along the Y-Axis.

edofLinearZ 

Linear along the Z-Axis.

edofAngularX 

Angular around the X-Axis.

edofAngularY 

Angular around the Y-Axis.

edofAngularZ 

Angular around the Z-Axis.

Constructor & Destructor Documentation

◆ deColliderConstraint() [1/2]

deColliderConstraint::deColliderConstraint ( )

Creates a new collider constraint.

◆ deColliderConstraint() [2/2]

deColliderConstraint::deColliderConstraint ( const deColliderConstraint constraint)

Creates a new collider constraint as a copy of another constraint.

◆ ~deColliderConstraint()

virtual deColliderConstraint::~deColliderConstraint ( )
virtual

Cleans up the collider constraint.

Member Function Documentation

◆ GetAngularDamping()

float deColliderConstraint::GetAngularDamping ( ) const
inline

Retrieves the angular damping.

References SetAngularDamping().

◆ GetBone()

int deColliderConstraint::GetBone ( ) const
inline

Retrieves the bone index or -1 if constraint the entire collider.

References operator=(), and SetBone().

◆ GetBreakingThreshold()

float deColliderConstraint::GetBreakingThreshold ( ) const
inline

Retrieves the breaking impulse threshold or 0 if disabled.

References SetBreakingThreshold().

◆ GetDof() [1/2]

deColliderConstraintDof& deColliderConstraint::GetDof ( eDegreesOfFreedom  dof)

Retrieves a degree of freedom.

Referenced by GetOrientation2().

◆ GetDof() [2/2]

const deColliderConstraintDof& deColliderConstraint::GetDof ( eDegreesOfFreedom  dof) const

◆ GetDofAngularX() [1/2]

deColliderConstraintDof& deColliderConstraint::GetDofAngularX ( )
inline

Retrieves the x-axis angular degree of freedom.

References edofAngularX.

◆ GetDofAngularX() [2/2]

const deColliderConstraintDof& deColliderConstraint::GetDofAngularX ( ) const
inline

References edofAngularX.

◆ GetDofAngularY() [1/2]

deColliderConstraintDof& deColliderConstraint::GetDofAngularY ( )
inline

Retrieves the y-axis angular degree of freedom.

References edofAngularY.

◆ GetDofAngularY() [2/2]

const deColliderConstraintDof& deColliderConstraint::GetDofAngularY ( ) const
inline

References edofAngularY.

◆ GetDofAngularZ() [1/2]

deColliderConstraintDof& deColliderConstraint::GetDofAngularZ ( )
inline

Retrieves the z-axis angular degree of freedom.

References edofAngularZ.

◆ GetDofAngularZ() [2/2]

const deColliderConstraintDof& deColliderConstraint::GetDofAngularZ ( ) const
inline

References edofAngularZ.

◆ GetDofLinearX() [1/2]

deColliderConstraintDof& deColliderConstraint::GetDofLinearX ( )
inline

Retrieves the x-axis linear degree of freedom.

References edofLinearX.

◆ GetDofLinearX() [2/2]

const deColliderConstraintDof& deColliderConstraint::GetDofLinearX ( ) const
inline

References edofLinearX.

◆ GetDofLinearY() [1/2]

deColliderConstraintDof& deColliderConstraint::GetDofLinearY ( )
inline

Retrieves the y-axis linear degree of freedom.

References edofLinearY.

◆ GetDofLinearY() [2/2]

const deColliderConstraintDof& deColliderConstraint::GetDofLinearY ( ) const
inline

References edofLinearY.

◆ GetDofLinearZ() [1/2]

deColliderConstraintDof& deColliderConstraint::GetDofLinearZ ( )
inline

Retrieves the z-axis linear degree of freedom.

References edofLinearZ.

◆ GetDofLinearZ() [2/2]

const deColliderConstraintDof& deColliderConstraint::GetDofLinearZ ( ) const
inline

References edofLinearZ.

◆ GetIsRope()

bool deColliderConstraint::GetIsRope ( ) const
inline

Determines if this constraint is a rope.

References SetIsRope().

◆ GetLinearDamping()

float deColliderConstraint::GetLinearDamping ( ) const
inline

Retrieves the linear damping.

References SetLinearDamping().

◆ GetOrientation1()

const decQuaternion& deColliderConstraint::GetOrientation1 ( ) const
inline

Retrieves the orientation of the reference coordinate system.

References SetOrientation1().

◆ GetOrientation2()

const decQuaternion& deColliderConstraint::GetOrientation2 ( ) const
inline

Retrieves the orientation of the reference coordinate system.

References GetDof(), and SetOrientation2().

◆ GetPosition1()

const decVector& deColliderConstraint::GetPosition1 ( ) const
inline

Retrieves the position of the reference coordinate system.

References SetPosition1().

◆ GetPosition2()

const decVector& deColliderConstraint::GetPosition2 ( ) const
inline

Retrieves the position of the reference coordinate system.

References SetPosition2().

◆ GetSpringDamping()

float deColliderConstraint::GetSpringDamping ( ) const
inline

◆ GetTargetBone()

const decString& deColliderConstraint::GetTargetBone ( ) const
inline

Retrieves the name of the target bone.

References SetTargetBone().

◆ GetTargetCollider()

deCollider* deColliderConstraint::GetTargetCollider ( ) const
inline

Retrieves the target collider or NULL to constraint to the world.

References SetTargetCollider().

◆ LockAll()

void deColliderConstraint::LockAll ( )

Locks all degrees of freedom.

Referenced by GetSpringDamping().

◆ operator=()

deColliderConstraint& deColliderConstraint::operator= ( const deColliderConstraint constraint)

Set constraint with parameters from another constraint.

Referenced by GetBone().

◆ SetAngularDamping()

void deColliderConstraint::SetAngularDamping ( float  damping)

Sets the angular damping.

Referenced by GetAngularDamping().

◆ SetBone()

void deColliderConstraint::SetBone ( int  bone)

Sets the bone index or -1 if constraint the entire collider.

Referenced by GetBone().

◆ SetBreakingThreshold()

void deColliderConstraint::SetBreakingThreshold ( float  impulseThreshold)

Sets the breaking impulse threshold or 0 to disable.

Referenced by GetBreakingThreshold().

◆ SetIsRope()

void deColliderConstraint::SetIsRope ( bool  isRope)

Sets if this constraint is a rope.

Referenced by GetIsRope().

◆ SetLinearDamping()

void deColliderConstraint::SetLinearDamping ( float  damping)

Sets the linear damping.

Referenced by GetLinearDamping().

◆ SetOrientation1()

void deColliderConstraint::SetOrientation1 ( const decQuaternion orientation)

Sets the orientation of the reference coordinate system.

Referenced by GetOrientation1().

◆ SetOrientation2()

void deColliderConstraint::SetOrientation2 ( const decQuaternion orientation)

Sets the orientation of the reference coordinate system.

Referenced by GetOrientation2().

◆ SetPosition1()

void deColliderConstraint::SetPosition1 ( const decVector position)

Sets the position of the reference coordinate system.

Referenced by GetPosition1().

◆ SetPosition2()

void deColliderConstraint::SetPosition2 ( const decVector position)

Sets the position of the reference coordinate system.

Referenced by GetPosition2().

◆ SetSpringDamping()

void deColliderConstraint::SetSpringDamping ( float  damping)

Sets the spring damping.

Referenced by GetSpringDamping().

◆ SetSpringLinear1D()

void deColliderConstraint::SetSpringLinear1D ( eDegreesOfFreedom  degreeOfFreedom,
float  stiffness,
float  damping,
float  bendStiffness 
)

Sets a one-dimensional linear spring with bending properties. The given linear degree of freedom is set free with the given spring stiffness and damping. All other linear degrees of freedom are set free to with the given bending stiffness and damping. All angular degrees of freedom are locked.

Referenced by GetSpringDamping().

◆ SetTargetBone()

void deColliderConstraint::SetTargetBone ( const char *  bone)

Sets the name of the target bone.

Referenced by GetTargetBone().

◆ SetTargetCollider()

void deColliderConstraint::SetTargetCollider ( deCollider collider)

Sets the target collider or NULL to constraint to the world.

Referenced by GetTargetCollider().

◆ SetToBallJoint()

void deColliderConstraint::SetToBallJoint ( )

Locks all linear degrees of freedom and sets all angular degrees of freedom free.

Referenced by GetSpringDamping().

◆ SetToHingeJoint()

void deColliderConstraint::SetToHingeJoint ( eDegreesOfFreedom  degreeOfFreedom,
float  lowerLimit,
float  upperLimit 
)

Sets the upper and lower limit for the given angular degree of freedom and locks all others ( hinge joint ).

Referenced by GetSpringDamping().

◆ SetToPistonJoint()

void deColliderConstraint::SetToPistonJoint ( eDegreesOfFreedom  degreeOfFreedom,
float  lowerLimit,
float  upperLimit 
)

Sets the upper and lower limit for the given linear degree of freem and locks all others.

Referenced by GetSpringDamping().


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