Blender V5.0
btGeneric6DofConstraint.h File Reference

Go to the source code of this file.

Classes

class  btRotationalLimitMotor
 Rotation Limit structure for generic joints. More...
class  btTranslationalLimitMotor
struct  btGeneric6DofConstraintData
struct  btGeneric6DofConstraintDoubleData2

Macros

#define btGeneric6DofConstraintData2   btGeneric6DofConstraintData
#define btGeneric6DofConstraintDataName   "btGeneric6DofConstraintData"
#define BT_6DOF_FLAGS_AXIS_SHIFT   3

Enumerations

enum  bt6DofFlags { BT_6DOF_FLAGS_CFM_NORM = 1 , BT_6DOF_FLAGS_CFM_STOP = 2 , BT_6DOF_FLAGS_ERP_STOP = 4 }

Functions

btGeneric6DofConstraintoperator= (btGeneric6DofConstraint &other)
int setAngularLimits (btConstraintInfo2 *info, int row_offset, const btTransform &transA, const btTransform &transB, const btVector3 &linVelA, const btVector3 &linVelB, const btVector3 &angVelA, const btVector3 &angVelB)
int setLinearLimits (btConstraintInfo2 *info, int row, const btTransform &transA, const btTransform &transB, const btVector3 &linVelA, const btVector3 &linVelB, const btVector3 &angVelA, const btVector3 &angVelB)
void buildLinearJacobian (btJacobianEntry &jacLinear, const btVector3 &normalWorld, const btVector3 &pivotAInW, const btVector3 &pivotBInW)
void buildAngularJacobian (btJacobianEntry &jacAngular, const btVector3 &jointAxisW)
void calculateLinearInfo ()
void calculateAngleInfo ()
 calcs the euler angles between the two bodies.
 BT_DECLARE_ALIGNED_ALLOCATOR ()
 btGeneric6DofConstraint (btRigidBody &rbA, btRigidBody &rbB, const btTransform &frameInA, const btTransform &frameInB, bool useLinearReferenceFrameA)
 btGeneric6DofConstraint (btRigidBody &rbB, const btTransform &frameInB, bool useLinearReferenceFrameB)
void calculateTransforms (const btTransform &transA, const btTransform &transB)
 Calcs global transform of the offsets.
void calculateTransforms ()
const btTransformgetCalculatedTransformA () const
 Gets the global transform of the offset for body A.
const btTransformgetCalculatedTransformB () const
 Gets the global transform of the offset for body B.
const btTransformgetFrameOffsetA () const
const btTransformgetFrameOffsetB () const
virtual void buildJacobian ()
 performs Jacobian calculation, and also calculates angle differences and axis
virtual void getInfo1 (btConstraintInfo1 *info)
void getInfo1NonVirtual (btConstraintInfo1 *info)
virtual void getInfo2 (btConstraintInfo2 *info)
void getInfo2NonVirtual (btConstraintInfo2 *info, const btTransform &transA, const btTransform &transB, const btVector3 &linVelA, const btVector3 &linVelB, const btVector3 &angVelA, const btVector3 &angVelB)
void updateRHS (btScalar timeStep)
btVector3 getAxis (int axis_index) const
 Get the rotation axis in global coordinates.
btScalar getAngle (int axis_index) const
 Get the relative Euler angle.
btScalar getRelativePivotPosition (int axis_index) const
 Get the relative position of the constraint pivot.
void setFrames (const btTransform &frameA, const btTransform &frameB)
bool testAngularLimitMotor (int axis_index)
 Test angular limit.
void setLinearLowerLimit (const btVector3 &linearLower)
void getLinearLowerLimit (btVector3 &linearLower) const
void setLinearUpperLimit (const btVector3 &linearUpper)
void getLinearUpperLimit (btVector3 &linearUpper) const
void setAngularLowerLimit (const btVector3 &angularLower)
void getAngularLowerLimit (btVector3 &angularLower) const
void setAngularUpperLimit (const btVector3 &angularUpper)
void getAngularUpperLimit (btVector3 &angularUpper) const
btRotationalLimitMotorgetRotationalLimitMotor (int index)
 Retrieves the angular limit informacion.
btTranslationalLimitMotorgetTranslationalLimitMotor ()
 Retrieves the limit informacion.
void setLimit (int axis, btScalar lo, btScalar hi)
bool isLimited (int limitIndex) const
 Test limit.
virtual void calcAnchorPos (void)
int get_limit_motor_info2 (btRotationalLimitMotor *limot, const btTransform &transA, const btTransform &transB, const btVector3 &linVelA, const btVector3 &linVelB, const btVector3 &angVelA, const btVector3 &angVelB, btConstraintInfo2 *info, int row, btVector3 &ax1, int rotational, int rotAllowed=false)
bool getUseFrameOffset () const
void setUseFrameOffset (bool frameOffsetOnOff)
bool getUseLinearReferenceFrameA () const
void setUseLinearReferenceFrameA (bool linearReferenceFrameA)
virtual void setParam (int num, btScalar value, int axis=-1)
virtual btScalar getParam (int num, int axis=-1) const
 return the local value of parameter
void setAxis (const btVector3 &axis1, const btVector3 &axis2)
virtual int getFlags () const
virtual int calculateSerializeBufferSize () const
virtual const char * serialize (void *dataBuffer, btSerializer *serializer) const
 fills the dataBuffer and returns the struct name (and 0 on failure)

Variables

btGeneric6DofConstraint __pad0__
 btGeneric6DofConstraint between two rigidbodies each with a pivotpoint that descibes the axis location in local space
btTransform m_frameInB
 the constraint space w.r.t body B
bool m_useSolveConstraintObsolete
 for backwards compatibility during the transition to 'getInfo/getInfo2'
btJacobianEntry m_jacLinear [3]
 3 orthogonal linear constraints
btJacobianEntry m_jacAng [3]
 3 orthogonal angular constraints
btTranslationalLimitMotor m_linearLimits
btRotationalLimitMotor m_angularLimits [3]
btScalar m_timeStep
btTransform m_calculatedTransformA
btTransform m_calculatedTransformB
btVector3 m_calculatedAxisAngleDiff
btVector3 m_calculatedAxis [3]
btVector3 m_calculatedLinearDiff
btScalar m_factA
btScalar m_factB
bool m_hasStaticBody
btVector3 m_AnchorPos
bool m_useLinearReferenceFrameA
bool m_useOffsetForConstraintFrame
int m_flags

Macro Definition Documentation

◆ BT_6DOF_FLAGS_AXIS_SHIFT

#define BT_6DOF_FLAGS_AXIS_SHIFT   3

Definition at line 228 of file btGeneric6DofConstraint.h.

Referenced by setAngularLimits(), and setLinearLimits().

◆ btGeneric6DofConstraintData2

#define btGeneric6DofConstraintData2   btGeneric6DofConstraintData

Definition at line 39 of file btGeneric6DofConstraint.h.

◆ btGeneric6DofConstraintDataName

#define btGeneric6DofConstraintDataName   "btGeneric6DofConstraintData"

Definition at line 40 of file btGeneric6DofConstraint.h.

Enumeration Type Documentation

◆ bt6DofFlags

Enumerator
BT_6DOF_FLAGS_CFM_NORM 
BT_6DOF_FLAGS_CFM_STOP 
BT_6DOF_FLAGS_ERP_STOP 

Definition at line 222 of file btGeneric6DofConstraint.h.

Function Documentation

◆ BT_DECLARE_ALIGNED_ALLOCATOR()

BT_DECLARE_ALIGNED_ALLOCATOR ( )

◆ btGeneric6DofConstraint() [1/2]

◆ btGeneric6DofConstraint() [2/2]

btGeneric6DofConstraint::btGeneric6DofConstraint ( btRigidBody & rbB,
const btTransform & frameInB,
bool useLinearReferenceFrameB )

◆ buildAngularJacobian()

void btGeneric6DofConstraint::buildAngularJacobian ( btJacobianEntry & jacAngular,
const btVector3 & jointAxisW )
protected

Definition at line 381 of file btGeneric6DofConstraint.cpp.

References btJacobianEntry, btVector3, m_rbA, and m_rbB.

◆ buildJacobian()

virtual void buildJacobian ( )
virtual

performs Jacobian calculation, and also calculates angle differences and axis

performs Jacobian calculation, and also calculates angle differences and axis

performs Jacobian calculation, and also calculates angle differences and axis

obsolete methods

we need it for both methods

Definition at line 322 of file btGeneric6DofSpring2Constraint.h.

◆ buildLinearJacobian()

void btGeneric6DofConstraint::buildLinearJacobian ( btJacobianEntry & jacLinear,
const btVector3 & normalWorld,
const btVector3 & pivotAInW,
const btVector3 & pivotBInW )
protected

Definition at line 365 of file btGeneric6DofConstraint.cpp.

References btJacobianEntry, btVector3, m_rbA, and m_rbB.

◆ calcAnchorPos()

void btGeneric6DofConstraint::calcAnchorPos ( void )
virtual

◆ calculateAngleInfo()

void btGeneric6DofSpring2Constraint::calculateAngleInfo ( )
protected

calcs the euler angles between the two bodies.

Definition at line 306 of file btGeneric6DofConstraint.cpp.

References btMatrix3x3, btVector3, m_calculatedAxis, m_calculatedAxisAngleDiff, m_calculatedTransformA, m_calculatedTransformB, and matrixToEulerXYZ().

Referenced by calculateTransforms().

◆ calculateLinearInfo()

void btGeneric6DofSpring2Constraint::calculateLinearInfo ( )
protected

◆ calculateSerializeBufferSize()

virtual int calculateSerializeBufferSize ( ) const
virtual

◆ calculateTransforms() [1/2]

◆ calculateTransforms() [2/2]

void btSliderConstraint::calculateTransforms ( const btTransform & transA,
const btTransform & transB )

Calcs global transform of the offsets.

Calcs the global transform for the joint offset for body A an B, and also calcs the agle differences between the bodies.

See also
btGeneric6DofConstraint.getCalculatedTransformA , btGeneric6DofConstraint.getCalculatedTransformB, btGeneric6DofConstraint.calculateAngleInfo

Definition at line 341 of file btGeneric6DofConstraint.cpp.

References btTransform, calculateAngleInfo(), calculateLinearInfo(), btRigidBody::getInvMass(), getRigidBodyA(), getRigidBodyB(), m_calculatedTransformA, m_calculatedTransformB, m_factA, m_factB, m_frameInA, m_frameInB, m_hasStaticBody, m_useOffsetForConstraintFrame, and SIMD_EPSILON.

◆ get_limit_motor_info2()

◆ getAngle()

btScalar getAngle ( int axis_index) const

Get the relative Euler angle.

Precondition
btGeneric6DofConstraint::calculateTransforms() must be called previously.

Definition at line 350 of file btGeneric6DofSpring2Constraint.h.

References m_calculatedAxisAngleDiff.

Referenced by getAngle1(), and getAngle2().

◆ getAngularLowerLimit()

void getAngularLowerLimit ( btVector3 & angularLower) const

Definition at line 459 of file btGeneric6DofConstraint.h.

References btVector3, i, and m_angularLimits.

◆ getAngularUpperLimit()

void getAngularUpperLimit ( btVector3 & angularUpper) const

Definition at line 471 of file btGeneric6DofConstraint.h.

References btVector3, i, and m_angularLimits.

◆ getAxis()

btVector3 getAxis ( int axis_index) const

Get the rotation axis in global coordinates.

Precondition
btGeneric6DofConstraint.buildJacobian must be called previously.

Definition at line 347 of file btGeneric6DofSpring2Constraint.h.

References btVector3, and m_calculatedAxis.

◆ getCalculatedTransformA()

const btTransform & getCalculatedTransformA ( ) const

Gets the global transform of the offset for body A.

See also
btGeneric6DofConstraint.getFrameOffsetA, btGeneric6DofConstraint.getFrameOffsetB, btGeneric6DofConstraint.calculateAngleInfo.

Definition at line 359 of file btGeneric6DofConstraint.h.

References btTransform, and m_calculatedTransformA.

Referenced by getInfo2NonVirtual().

◆ getCalculatedTransformB()

const btTransform & getCalculatedTransformB ( ) const

Gets the global transform of the offset for body B.

See also
btGeneric6DofConstraint.getFrameOffsetA, btGeneric6DofConstraint.getFrameOffsetB, btGeneric6DofConstraint.calculateAngleInfo.

Definition at line 368 of file btGeneric6DofConstraint.h.

References btTransform, and m_calculatedTransformB.

Referenced by getInfo2NonVirtual().

◆ getFlags()

virtual int getFlags ( ) const
virtual

Definition at line 543 of file btGeneric6DofConstraint.h.

References m_flags.

◆ getFrameOffsetA()

const btTransform & getFrameOffsetA ( ) const

Definition at line 373 of file btGeneric6DofConstraint.h.

References btTransform, and m_frameInA.

◆ getFrameOffsetB()

const btTransform & getFrameOffsetB ( ) const

Definition at line 378 of file btGeneric6DofConstraint.h.

References btTransform, and m_frameInB.

◆ getInfo1()

virtual void getInfo1 ( btConstraintInfo1 * info)
virtual

◆ getInfo1NonVirtual()

void getInfo1NonVirtual ( btConstraintInfo1 * info)

◆ getInfo2()

virtual void getInfo2 ( btConstraintInfo2 * info)
virtual

References btTransform, and btVector3.

◆ getInfo2NonVirtual()

void btGeneric6DofConstraint::getInfo2NonVirtual ( btConstraintInfo2 * info,
const btTransform & transA,
const btTransform & transB,
const btVector3 & linVelA,
const btVector3 & linVelB,
const btVector3 & angVelA,
const btVector3 & angVelB )

◆ getLinearLowerLimit()

void getLinearLowerLimit ( btVector3 & linearLower) const

Definition at line 438 of file btGeneric6DofConstraint.h.

References btVector3, and m_linearLimits.

◆ getLinearUpperLimit()

void getLinearUpperLimit ( btVector3 & linearUpper) const

Definition at line 448 of file btGeneric6DofConstraint.h.

References btVector3, and m_linearLimits.

◆ getParam()

virtual btScalar getParam ( int num,
int axis = -1 ) const
virtual

return the local value of parameter

References btVector3, and num.

◆ getRelativePivotPosition()

btScalar btGeneric6DofConstraint::getRelativePivotPosition ( int axis_index) const

Get the relative position of the constraint pivot.

Precondition
btGeneric6DofConstraint::calculateTransforms() must be called previously.

Definition at line 650 of file btGeneric6DofConstraint.cpp.

References m_calculatedLinearDiff.

◆ getRotationalLimitMotor()

btRotationalLimitMotor * getRotationalLimitMotor ( int index)

Retrieves the angular limit informacion.

Definition at line 478 of file btGeneric6DofConstraint.h.

References m_angularLimits.

◆ getTranslationalLimitMotor()

btTranslationalLimitMotor * getTranslationalLimitMotor ( )

Retrieves the limit informacion.

Definition at line 484 of file btGeneric6DofConstraint.h.

References m_linearLimits.

◆ getUseFrameOffset()

bool getUseFrameOffset ( ) const

Definition at line 529 of file btGeneric6DofConstraint.h.

References m_useOffsetForConstraintFrame.

◆ getUseLinearReferenceFrameA()

bool getUseLinearReferenceFrameA ( ) const

Definition at line 532 of file btGeneric6DofConstraint.h.

References m_useLinearReferenceFrameA.

◆ isLimited()

bool isLimited ( int limitIndex) const

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 513 of file btGeneric6DofConstraint.h.

References m_angularLimits, and m_linearLimits.

◆ operator=()

◆ serialize()

virtual const char * serialize ( void * dataBuffer,
btSerializer * serializer ) const
virtual

fills the dataBuffer and returns the struct name (and 0 on failure)

◆ setAngularLimits()

int btGeneric6DofSpring2Constraint::setAngularLimits ( btConstraintInfo2 * info,
int row_offset,
const btTransform & transA,
const btTransform & transB,
const btVector3 & linVelA,
const btVector3 & linVelB,
const btVector3 & angVelA,
const btVector3 & angVelB )
protected

◆ setAngularLowerLimit()

void setAngularLowerLimit ( const btVector3 & angularLower)

◆ setAngularUpperLimit()

void setAngularUpperLimit ( const btVector3 & angularUpper)

◆ setAxis()

void btUniversalConstraint::setAxis ( const btVector3 & axis1,
const btVector3 & axis2 )

◆ setFrames()

void setFrames ( const btTransform & frameA,
const btTransform & frameB )

◆ setLimit()

void setLimit ( int axis,
btScalar lo,
btScalar hi )

Definition at line 490 of file btGeneric6DofConstraint.h.

References btNormalizeAngle(), m_angularLimits, and m_linearLimits.

◆ setLinearLimits()

◆ setLinearLowerLimit()

void setLinearLowerLimit ( const btVector3 & linearLower)

Definition at line 433 of file btGeneric6DofConstraint.h.

References btVector3, and m_linearLimits.

Referenced by btHinge2Constraint(), and btUniversalConstraint().

◆ setLinearUpperLimit()

void setLinearUpperLimit ( const btVector3 & linearUpper)

Definition at line 443 of file btGeneric6DofConstraint.h.

References btVector3, and m_linearLimits.

Referenced by btHinge2Constraint(), and btUniversalConstraint().

◆ setParam()

virtual void setParam ( int num,
btScalar value,
int axis = -1 )
virtual

override the default global value of a parameter (such as ERP or CFM), optionally provide the axis (0..5). If no axis is provided, it uses the default axis for this constraint.

References num.

◆ setUseFrameOffset()

void setUseFrameOffset ( bool frameOffsetOnOff)

Definition at line 530 of file btGeneric6DofConstraint.h.

References m_useOffsetForConstraintFrame.

◆ setUseLinearReferenceFrameA()

void setUseLinearReferenceFrameA ( bool linearReferenceFrameA)

Definition at line 533 of file btGeneric6DofConstraint.h.

References m_useLinearReferenceFrameA.

◆ testAngularLimitMotor()

void btGeneric6DofSpring2Constraint::testAngularLimitMotor ( int axis_index)

Test angular limit.

Calculates angular correction and returns true if limit needs to be corrected.

Precondition
btGeneric6DofConstraint::calculateTransforms() must be called previously.

Definition at line 391 of file btGeneric6DofConstraint.cpp.

References angle(), btAdjustAngleToLimits(), m_angularLimits, and m_calculatedAxisAngleDiff.

Referenced by getInfo2NonVirtual().

◆ updateRHS()

void updateRHS ( btScalar timeStep)

References btTransform, and btVector3.

Variable Documentation

◆ __pad0__

btGeneric6DofConstraint between two rigidbodies each with a pivotpoint that descibes the axis location in local space

btGeneric6DofConstraint can leave any of the 6 degree of freedom 'free' or 'locked'. currently this limit supports rotational motors

  • For Linear limits, use btGeneric6DofConstraint.setLinearUpperLimit, btGeneric6DofConstraint.setLinearLowerLimit. You can set the parameters with the btTranslationalLimitMotor structure accsesible through the btGeneric6DofConstraint.getTranslationalLimitMotor method. At this moment translational motors are not supported. May be in the future.

  • For Angular limits, use the btRotationalLimitMotor structure for configuring the limit. This is accessible through btGeneric6DofConstraint.getLimitMotor method, This brings support for limit parameters and motors.

  • Angulars limits have these possible ranges:
    AXISMIN ANGLEMAX ANGLE
    X-PIPI
    Y-PI/2PI/2
    Z-PIPI

the constraint space w.r.t body A

Definition at line 267 of file btGeneric6DofConstraint.h.

◆ m_AnchorPos

btVector3 m_AnchorPos
protected

Definition at line 305 of file btGeneric6DofConstraint.h.

Referenced by calcAnchorPos().

◆ m_angularLimits

◆ m_calculatedAxis

btVector3 m_calculatedAxis[3]
protected

Definition at line 299 of file btGeneric6DofConstraint.h.

Referenced by calculateAngleInfo(), and getAxis().

◆ m_calculatedAxisAngleDiff

◆ m_calculatedLinearDiff

◆ m_calculatedTransformA

◆ m_calculatedTransformB

◆ m_factA

btScalar m_factA
protected

◆ m_factB

btScalar m_factB
protected

◆ m_flags

int m_flags
protected

Definition at line 310 of file btGeneric6DofConstraint.h.

◆ m_frameInB

◆ m_hasStaticBody

bool m_hasStaticBody
protected

◆ m_jacAng

btJacobianEntry m_jacAng[3]

3 orthogonal angular constraints

Definition at line 279 of file btGeneric6DofConstraint.h.

◆ m_jacLinear

btJacobianEntry m_jacLinear[3]

3 orthogonal linear constraints

Jacobians

Definition at line 278 of file btGeneric6DofConstraint.h.

◆ m_linearLimits

◆ m_timeStep

btScalar m_timeStep
protected

temporal variables

Definition at line 295 of file btGeneric6DofConstraint.h.

◆ m_useLinearReferenceFrameA

◆ m_useOffsetForConstraintFrame

◆ m_useSolveConstraintObsolete

bool m_useSolveConstraintObsolete

for backwards compatibility during the transition to 'getInfo/getInfo2'

Definition at line 341 of file btGeneric6DofConstraint.h.