Back to index

supertuxkart  0.5+dfsg1
Public Member Functions | Public Attributes
btTranslationalLimitMotor Class Reference

#include <btGeneric6DofConstraint.h>

Collaboration diagram for btTranslationalLimitMotor:
Collaboration graph

List of all members.

Public Member Functions

 btTranslationalLimitMotor ()
 btTranslationalLimitMotor (const btTranslationalLimitMotor &other)
bool isLimited (int limitIndex)
 Test limit.
btScalar solveLinearAxis (btScalar timeStep, btScalar jacDiagABInv, btRigidBody &body1, const btVector3 &pointInA, btRigidBody &body2, const btVector3 &pointInB, int limit_index, const btVector3 &axis_normal_on_a)

Public Attributes

btVector3 m_lowerLimit
 the constraint lower limits
btVector3 m_upperLimit
 the constraint upper limits
btVector3 m_accumulatedImpulse
btScalar m_limitSoftness
btScalar m_damping
 Damping for linear limit.
btScalar m_restitution

Detailed Description

Definition at line 120 of file btGeneric6DofConstraint.h.

Constructor & Destructor Documentation

Definition at line 133 of file btGeneric6DofConstraint.h.


       m_limitSoftness = 0.7f;
       m_damping = btScalar(1.0f);
       m_restitution = btScalar(0.5f);

Here is the call graph for this function:

Member Function Documentation

bool btTranslationalLimitMotor::isLimited ( int  limitIndex) [inline]

Test limit.

  • free means upper < lower,
  • locked means upper == lower
  • limited means upper > lower
  • limitIndex: first 3 are linear, next 3 are angular

Definition at line 162 of file btGeneric6DofConstraint.h.

       return (m_upperLimit[limitIndex] >= m_lowerLimit[limitIndex]);

Here is the caller graph for this function:

btScalar btTranslationalLimitMotor::solveLinearAxis ( btScalar  timeStep,
btScalar  jacDiagABInv,
btRigidBody body1,
const btVector3 pointInA,
btRigidBody body2,
const btVector3 pointInB,
int  limit_index,
const btVector3 axis_normal_on_a 

find relative velocity

apply displacement correction

Definition at line 196 of file btGeneric6DofConstraint.cpp.


    btVector3 rel_pos1 = pointInA - body1.getCenterOfMassPosition();
    btVector3 rel_pos2 = pointInB - body2.getCenterOfMassPosition();

    btVector3 vel1 = body1.getVelocityInLocalPoint(rel_pos1);
    btVector3 vel2 = body2.getVelocityInLocalPoint(rel_pos2);
    btVector3 vel = vel1 - vel2;

    btScalar rel_vel =;

//positional error (zeroth order error)
    btScalar depth = -(pointInA - pointInB).dot(axis_normal_on_a);
    btScalar  lo = btScalar(-1e30);
    btScalar  hi = btScalar(1e30);

    btScalar minLimit = m_lowerLimit[limit_index];
    btScalar maxLimit = m_upperLimit[limit_index];

    //handle the limits
    if (minLimit < maxLimit)
            if (depth > maxLimit)
                depth -= maxLimit;
                lo = btScalar(0.);

                if (depth < minLimit)
                    depth -= minLimit;
                    hi = btScalar(0.);
                    return 0.0f;

    btScalar normalImpulse= m_limitSoftness*(m_restitution*depth/timeStep - m_damping*rel_vel) * jacDiagABInv;

    btScalar oldNormalImpulse = m_accumulatedImpulse[limit_index];
    btScalar sum = oldNormalImpulse + normalImpulse;
    m_accumulatedImpulse[limit_index] = sum > hi ? btScalar(0.) : sum < lo ? btScalar(0.) : sum;
    normalImpulse = m_accumulatedImpulse[limit_index] - oldNormalImpulse;

    btVector3 impulse_vector = axis_normal_on_a * normalImpulse;
    body1.applyImpulse( impulse_vector, rel_pos1);
    body2.applyImpulse(-impulse_vector, rel_pos2);
    return normalImpulse;

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

Definition at line 125 of file btGeneric6DofConstraint.h.

Damping for linear limit.

Definition at line 129 of file btGeneric6DofConstraint.h.


Softness for linear limit

Definition at line 128 of file btGeneric6DofConstraint.h.

the constraint lower limits

Definition at line 123 of file btGeneric6DofConstraint.h.

Definition at line 130 of file btGeneric6DofConstraint.h.

the constraint upper limits

Definition at line 124 of file btGeneric6DofConstraint.h.

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