27 #ifndef BT_GENERIC_6DOF_CONSTRAINT_H 28 #define BT_GENERIC_6DOF_CONSTRAINT_H 38 #ifdef BT_USE_DOUBLE_PRECISION 39 #define btGeneric6DofConstraintData2 btGeneric6DofConstraintDoubleData2 40 #define btGeneric6DofConstraintDataName "btGeneric6DofConstraintDoubleData2" 42 #define btGeneric6DofConstraintData2 btGeneric6DofConstraintData 43 #define btGeneric6DofConstraintDataName "btGeneric6DofConstraintData" 44 #endif //BT_USE_DOUBLE_PRECISION 78 m_accumulatedImpulse = 0.f;
80 m_maxMotorForce = 6.0f;
81 m_maxLimitForce = 300.0f;
89 m_limitSoftness = 0.5f;
91 m_currentLimitError = 0;
92 m_enableMotor =
false;
116 if(m_loLimit > m_hiLimit)
return false;
123 if(m_currentLimit == 0 && m_enableMotor ==
false)
return false;
166 m_accumulatedImpulse.
setValue(0.f,0.f,0.f);
167 m_normalCFM.
setValue(0.f, 0.f, 0.f);
168 m_stopERP.
setValue(0.2f, 0.2f, 0.2f);
171 m_limitSoftness = 0.7f;
174 for(
int i=0; i < 3; i++)
176 m_enableMotor[i] =
false;
177 m_targetVelocity[i] =
btScalar(0.f);
195 for(
int i=0; i < 3; i++)
212 return (m_upperLimit[limitIndex] >= m_lowerLimit[limitIndex]);
216 if(m_currentLimit[limitIndex] == 0 && m_enableMotor[limitIndex] ==
false)
return false;
240 #define BT_6DOF_FLAGS_AXIS_SHIFT 3 // bits per axis 341 void buildLinearJacobian(
348 void calculateLinearInfo();
351 void calculateAngleInfo();
372 void calculateTransforms();
380 return m_calculatedTransformA;
389 return m_calculatedTransformB;
415 virtual void buildJacobian();
438 btScalar getAngle(
int axis_index)
const;
444 btScalar getRelativePivotPosition(
int axis_index)
const;
453 bool testAngularLimitMotor(
int axis_index);
477 for(
int i = 0; i < 3; i++)
483 for(
int i = 0; i < 3; i++)
484 angularLower[i] = m_angularLimits[i].
m_loLimit;
489 for(
int i = 0; i < 3; i++)
495 for(
int i = 0; i < 3; i++)
496 angularUpper[i] = m_angularLimits[i].
m_hiLimit;
502 return &m_angularLimits[index];
508 return &m_linearLimits;
539 return m_linearLimits.
isLimited(limitIndex);
542 return m_angularLimits[limitIndex-3].
isLimited();
545 virtual void calcAnchorPos(
void);
553 void setUseFrameOffset(
bool frameOffsetOnOff) { m_useOffsetForConstraintFrame = frameOffsetOnOff; }
560 virtual void setParam(
int num,
btScalar value,
int axis = -1);
562 virtual btScalar getParam(
int num,
int axis = -1)
const;
571 virtual int calculateSerializeBufferSize()
const;
574 virtual const char* serialize(
void* dataBuffer,
btSerializer* serializer)
const;
624 m_frameInA.serialize(dof->m_rbAFrame);
625 m_frameInB.serialize(dof->m_rbBFrame);
631 dof->m_angularLowerLimit.m_floats[i] = m_angularLimits[i].m_loLimit;
632 dof->m_angularUpperLimit.m_floats[i] = m_angularLimits[i].m_hiLimit;
633 dof->m_linearLowerLimit.m_floats[i] = m_linearLimits.m_lowerLimit[i];
634 dof->m_linearUpperLimit.m_floats[i] = m_linearLimits.m_upperLimit[i];
637 dof->m_useLinearReferenceFrameA = m_useLinearReferenceFrameA? 1 : 0;
638 dof->m_useOffsetForConstraintFrame = m_useOffsetForConstraintFrame ? 1 : 0;
647 #endif //BT_GENERIC_6DOF_CONSTRAINT_H btScalar m_damping
Damping for linear limit.
btTransform & getFrameOffsetB()
btScalar m_timeStep
temporal variables
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z)
bool m_useLinearReferenceFrameA
Jacobian entry is an abstraction that allows to describe constraints it can be used in combination wi...
const btTransform & getCalculatedTransformA() const
Gets the global transform of the offset for body A.
btScalar m_currentPosition
How much is violated this limit.
btScalar m_loLimit
limit_parameters
btRotationalLimitMotor(const btRotationalLimitMotor &limot)
const btTransform & getCalculatedTransformB() const
Gets the global transform of the offset for body B.
#define btGeneric6DofConstraintData2
btTypedConstraintData m_typeConstraintData
btTranslationalLimitMotor * getTranslationalLimitMotor()
Retrieves the limit informacion.
btGeneric6DofConstraint between two rigidbodies each with a pivotpoint that descibes the axis locatio...
btScalar m_stopERP
Error tolerance factor when joint is at limit.
void setUseLinearReferenceFrameA(bool linearReferenceFrameA)
btScalar m_currentLimitError
temp_variables
btVector3 m_targetVelocity
target motor velocity
btTransform m_calculatedTransformA
btScalar m_normalCFM
Relaxation factor.
btScalar m_stopCFM
Constraint force mixing factor when joint is at limit.
void getLinearLowerLimit(btVector3 &linearLower) const
bool getUseLinearReferenceFrameA() const
btVector3FloatData m_linearLowerLimit
#define SIMD_FORCE_INLINE
const btTransform & getFrameOffsetA() const
void setAngularUpperLimit(const btVector3 &angularUpper)
btVector3 m_upperLimit
the constraint upper limits
btVector3DoubleData m_linearLowerLimit
virtual int getFlags() const
btScalar m_limitSoftness
Linear_Limit_parameters.
btTransformFloatData m_rbBFrame
int m_useOffsetForConstraintFrame
bool m_useSolveConstraintObsolete
for backwards compatibility during the transition to 'getInfo/getInfo2'
virtual const char * serialize(void *dataBuffer, btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
btVector3 m_calculatedAxisAngleDiff
bool m_useOffsetForConstraintFrame
void getAngularLowerLimit(btVector3 &angularLower) const
bool isLimited(int limitIndex) const
Test limit.
btVector3FloatData m_angularLowerLimit
btScalar m_accumulatedImpulse
bool getUseFrameOffset() const
int m_useLinearReferenceFrameA
btVector3DoubleData m_angularLowerLimit
btVector3FloatData m_linearUpperLimit
btGeneric6DofConstraint & operator=(btGeneric6DofConstraint &other)
btVector3 m_normalCFM
Bounce parameter for linear limit.
#define btGeneric6DofConstraintDataName
btTranslationalLimitMotor m_linearLimits
Linear_Limit_parameters.
bool needApplyForce(int limitIndex) const
btVector3 m_stopCFM
Constraint force mixing factor when joint is at limit.
bool needApplyTorques() const
Need apply correction.
btScalar m_targetVelocity
target motor velocity
virtual int calculateSerializeBufferSize() const
btTypedConstraintDoubleData m_typeConstraintData
btVector3DoubleData m_angularUpperLimit
The btRigidBody is the main class for rigid body objects.
btVector3 m_lowerLimit
the constraint lower limits
int m_useLinearReferenceFrameA
btTransform m_calculatedTransformB
this structure is not used, except for loading pre-2.82 .bullet files
btTransformDoubleData m_rbAFrame
btTransform & getFrameOffsetA()
btVector3 m_calculatedLinearDiff
btVector3 m_currentLimitError
int m_currentLimit
current value of angle
btTranslationalLimitMotor(const btTranslationalLimitMotor &other)
btVector3 can be used to represent 3D points and vectors.
#define ATTRIBUTE_ALIGNED16(a)
btTransform m_frameInA
relative_frames
btScalar btNormalizeAngle(btScalar angleInRadians)
btScalar m_damping
Damping.
const btTransform & getFrameOffsetB() const
void getLinearUpperLimit(btVector3 &linearUpper) const
btScalar m_hiLimit
joint limit
int testLimitValue(btScalar test_value)
calculates error
btTransform m_frameInB
the constraint space w.r.t body B
TypedConstraint is the baseclass for Bullet constraints and vehicles.
int m_useOffsetForConstraintFrame
btRotationalLimitMotor * getRotationalLimitMotor(int index)
Retrieves the angular limit informacion.
btScalar solveAngularLimits(btScalar timeStep, btVector3 &axis, btScalar jacDiagABInv, btRigidBody *body0, btRigidBody *body1)
apply the correction impulses for two bodies
bool isLimited() const
Is limited.
#define BT_DECLARE_ALIGNED_ALLOCATOR()
void getAngularUpperLimit(btVector3 &angularUpper) const
virtual const char * serialize(void *dataBuffer, btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
void setLinearLowerLimit(const btVector3 &linearLower)
btVector3DoubleData m_linearUpperLimit
btVector3 m_maxMotorForce
max force on motor
btScalar m_maxMotorForce
max force on motor
btScalar m_maxLimitForce
max force on limit
void setLimit(int axis, btScalar lo, btScalar hi)
btVector3 m_currentLinearDiff
How much is violated this limit.
btScalar m_bounce
restitution factor
btVector3 m_stopERP
Error tolerance factor when joint is at limit.
Rotation Limit structure for generic joints.
bool isLimited(int limitIndex) const
Test limit.
void setLinearUpperLimit(const btVector3 &linearUpper)
btVector3FloatData m_angularUpperLimit
btTransformFloatData m_rbAFrame
void setAngularLowerLimit(const btVector3 &angularLower)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
btTranslationalLimitMotor()
void setUseFrameOffset(bool frameOffsetOnOff)
btVector3 m_accumulatedImpulse
btTransformDoubleData m_rbBFrame