Drag[en]gine Game Engine  1.21
deColliderConstraint Class Reference

Collider Constraint. More...

#include <deColliderConstraint.h>

Public Types

enum  eDegreesOfFreedom {
  edofLinearX , edofLinearY , edofLinearZ , edofAngularX ,
  edofAngularY , edofAngularZ
}
 Degrees of freedom. More...
 

Public Member Functions

Constructors and Destructors
 deColliderConstraint ()
 Create new collider constraint. More...
 
 deColliderConstraint (const deColliderConstraint &constraint)
 Create new collider constraint as a copy of another constraint. More...
 
virtual ~deColliderConstraint ()
 Clean up collider constraint. More...
 
Management
deColliderGetTargetCollider () const
 Target collider or NULL to constraint to the world. More...
 
void SetTargetCollider (deCollider *collider)
 Set target collider or NULL to constraint to the world. More...
 
const decStringGetTargetBone () const
 Name of the target bone. More...
 
void SetTargetBone (const char *bone)
 Set name of the target bone. More...
 
const decVectorGetPosition1 () const
 Position of the reference coordinate system. More...
 
void SetPosition1 (const decVector &position)
 Set position of the reference coordinate system. More...
 
const decQuaternionGetOrientation1 () const
 Orientation of the reference coordinate system. More...
 
void SetOrientation1 (const decQuaternion &orientation)
 Set orientation of the reference coordinate system. More...
 
const decVectorGetPosition2 () const
 Position of the reference coordinate system. More...
 
void SetPosition2 (const decVector &position)
 Set position of the reference coordinate system. More...
 
const decQuaternionGetOrientation2 () const
 Orientation of the reference coordinate system. More...
 
void SetOrientation2 (const decQuaternion &orientation)
 Set orientation of the reference coordinate system. More...
 
deColliderConstraintDofGetDof (eDegreesOfFreedom dof)
 Retrieves a degree of freedom. More...
 
const deColliderConstraintDofGetDof (eDegreesOfFreedom dof) const
 
deColliderConstraintDofGetDofLinearX ()
 X-axis linear degree of freedom. More...
 
const deColliderConstraintDofGetDofLinearX () const
 
deColliderConstraintDofGetDofLinearY ()
 Y-axis linear degree of freedom. More...
 
const deColliderConstraintDofGetDofLinearY () const
 
deColliderConstraintDofGetDofLinearZ ()
 Z-axis linear degree of freedom. More...
 
const deColliderConstraintDofGetDofLinearZ () const
 
deColliderConstraintDofGetDofAngularX ()
 X-axis angular degree of freedom. More...
 
const deColliderConstraintDofGetDofAngularX () const
 
deColliderConstraintDofGetDofAngularY ()
 Y-axis angular degree of freedom. More...
 
const deColliderConstraintDofGetDofAngularY () const
 
deColliderConstraintDofGetDofAngularZ ()
 Z-axis angular degree of freedom. More...
 
const deColliderConstraintDofGetDofAngularZ () const
 
float GetLinearDamping () const
 Linear damping. More...
 
void SetLinearDamping (float damping)
 Set linear damping. More...
 
float GetAngularDamping () const
 Angular damping. More...
 
void SetAngularDamping (float damping)
 Set angular damping. More...
 
float GetSpringDamping () const
 Spring damping. More...
 
void SetSpringDamping (float damping)
 Set spring damping. More...
 
void LockAll ()
 Locks all degrees of freedom. More...
 
void SetToBallJoint ()
 Locks all linear degrees of freedom and sets all angular degrees of freedom free. More...
 
void SetToHingeJoint (eDegreesOfFreedom degreeOfFreedom, float lowerLimit, float upperLimit)
 Set upper and lower limit for angular degree of freedom and locks all others (hinge joint). More...
 
void SetToPistonJoint (eDegreesOfFreedom degreeOfFreedom, float lowerLimit, float upperLimit)
 Set upper and lower limit for linear degree of freem and locks all others. More...
 
void SetSpringLinear1D (eDegreesOfFreedom degreeOfFreedom, float stiffness, float damping, float bendStiffness)
 Set a one-dimensional linear spring with bending properties. More...
 
bool GetIsRope () const
 Determines if this constraint is a rope. More...
 
void SetIsRope (bool isRope)
 Sets if this constraint is a rope. More...
 
float GetBreakingThreshold () const
 Breaking impulse threshold or 0 if disabled. More...
 
void SetBreakingThreshold (float impulseThreshold)
 Set breaking impulse threshold or 0 to disable. More...
 
int GetBone () const
 Bone index or -1 if constraint the entire collider. More...
 
void SetBone (int bone)
 Set bone index or -1 if constraint the entire collider. More...
 
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.

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 ( )

Create new collider constraint.

◆ deColliderConstraint() [2/2]

deColliderConstraint::deColliderConstraint ( const deColliderConstraint constraint)

Create new collider constraint as a copy of another constraint.

◆ ~deColliderConstraint()

virtual deColliderConstraint::~deColliderConstraint ( )
virtual

Clean up collider constraint.

Member Function Documentation

◆ GetAngularDamping()

float deColliderConstraint::GetAngularDamping ( ) const
inline

Angular damping.

◆ GetBone()

int deColliderConstraint::GetBone ( ) const
inline

Bone index or -1 if constraint the entire collider.

◆ GetBreakingThreshold()

float deColliderConstraint::GetBreakingThreshold ( ) const
inline

Breaking impulse threshold or 0 if disabled.

◆ GetDof() [1/2]

deColliderConstraintDof& deColliderConstraint::GetDof ( eDegreesOfFreedom  dof)

Retrieves a degree of freedom.

◆ GetDof() [2/2]

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

◆ GetDofAngularX() [1/2]

deColliderConstraintDof& deColliderConstraint::GetDofAngularX ( )
inline

X-axis angular degree of freedom.

◆ GetDofAngularX() [2/2]

const deColliderConstraintDof& deColliderConstraint::GetDofAngularX ( ) const
inline

◆ GetDofAngularY() [1/2]

deColliderConstraintDof& deColliderConstraint::GetDofAngularY ( )
inline

Y-axis angular degree of freedom.

◆ GetDofAngularY() [2/2]

const deColliderConstraintDof& deColliderConstraint::GetDofAngularY ( ) const
inline

◆ GetDofAngularZ() [1/2]

deColliderConstraintDof& deColliderConstraint::GetDofAngularZ ( )
inline

Z-axis angular degree of freedom.

◆ GetDofAngularZ() [2/2]

const deColliderConstraintDof& deColliderConstraint::GetDofAngularZ ( ) const
inline

◆ GetDofLinearX() [1/2]

deColliderConstraintDof& deColliderConstraint::GetDofLinearX ( )
inline

X-axis linear degree of freedom.

◆ GetDofLinearX() [2/2]

const deColliderConstraintDof& deColliderConstraint::GetDofLinearX ( ) const
inline

◆ GetDofLinearY() [1/2]

deColliderConstraintDof& deColliderConstraint::GetDofLinearY ( )
inline

Y-axis linear degree of freedom.

◆ GetDofLinearY() [2/2]

const deColliderConstraintDof& deColliderConstraint::GetDofLinearY ( ) const
inline

◆ GetDofLinearZ() [1/2]

deColliderConstraintDof& deColliderConstraint::GetDofLinearZ ( )
inline

Z-axis linear degree of freedom.

◆ GetDofLinearZ() [2/2]

const deColliderConstraintDof& deColliderConstraint::GetDofLinearZ ( ) const
inline

◆ GetIsRope()

bool deColliderConstraint::GetIsRope ( ) const
inline

Determines if this constraint is a rope.

◆ GetLinearDamping()

float deColliderConstraint::GetLinearDamping ( ) const
inline

Linear damping.

◆ GetOrientation1()

const decQuaternion& deColliderConstraint::GetOrientation1 ( ) const
inline

Orientation of the reference coordinate system.

◆ GetOrientation2()

const decQuaternion& deColliderConstraint::GetOrientation2 ( ) const
inline

Orientation of the reference coordinate system.

◆ GetPosition1()

const decVector& deColliderConstraint::GetPosition1 ( ) const
inline

Position of the reference coordinate system.

◆ GetPosition2()

const decVector& deColliderConstraint::GetPosition2 ( ) const
inline

Position of the reference coordinate system.

◆ GetSpringDamping()

float deColliderConstraint::GetSpringDamping ( ) const
inline

Spring damping.

◆ GetTargetBone()

const decString& deColliderConstraint::GetTargetBone ( ) const
inline

Name of the target bone.

◆ GetTargetCollider()

deCollider* deColliderConstraint::GetTargetCollider ( ) const
inline

Target collider or NULL to constraint to the world.

◆ LockAll()

void deColliderConstraint::LockAll ( )

Locks all degrees of freedom.

◆ operator=()

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

Set constraint with parameters from another constraint.

◆ SetAngularDamping()

void deColliderConstraint::SetAngularDamping ( float  damping)

Set angular damping.

◆ SetBone()

void deColliderConstraint::SetBone ( int  bone)

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

◆ SetBreakingThreshold()

void deColliderConstraint::SetBreakingThreshold ( float  impulseThreshold)

Set breaking impulse threshold or 0 to disable.

◆ SetIsRope()

void deColliderConstraint::SetIsRope ( bool  isRope)

Sets if this constraint is a rope.

◆ SetLinearDamping()

void deColliderConstraint::SetLinearDamping ( float  damping)

Set linear damping.

◆ SetOrientation1()

void deColliderConstraint::SetOrientation1 ( const decQuaternion orientation)

Set orientation of the reference coordinate system.

◆ SetOrientation2()

void deColliderConstraint::SetOrientation2 ( const decQuaternion orientation)

Set orientation of the reference coordinate system.

◆ SetPosition1()

void deColliderConstraint::SetPosition1 ( const decVector position)

Set position of the reference coordinate system.

◆ SetPosition2()

void deColliderConstraint::SetPosition2 ( const decVector position)

Set position of the reference coordinate system.

◆ SetSpringDamping()

void deColliderConstraint::SetSpringDamping ( float  damping)

Set spring damping.

◆ SetSpringLinear1D()

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

Set 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.

◆ SetTargetBone()

void deColliderConstraint::SetTargetBone ( const char *  bone)

Set name of the target bone.

◆ SetTargetCollider()

void deColliderConstraint::SetTargetCollider ( deCollider collider)

Set target collider or NULL to constraint to the world.

◆ SetToBallJoint()

void deColliderConstraint::SetToBallJoint ( )

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

◆ SetToHingeJoint()

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

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

◆ SetToPistonJoint()

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

Set upper and lower limit for linear degree of freem and locks all others.


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