18#ifndef BT_HINGECONSTRAINT_H
19#define BT_HINGECONSTRAINT_H
21#define _BT_USE_CENTER_LIMIT_ 1
29#ifdef BT_USE_DOUBLE_PRECISION
30#define btHingeConstraintData btHingeConstraintDoubleData2
31#define btHingeConstraintDataName "btHingeConstraintDoubleData2"
33#define btHingeConstraintData btHingeConstraintFloatData
34#define btHingeConstraintDataName "btHingeConstraintFloatData"
50#ifdef IN_PARALLELL_SOLVER
62#ifdef _BT_USE_CENTER_LIMIT_
108 virtual void buildJacobian();
156 m_angularOnly = angularOnly;
161 m_enableAngularMotor = enableMotor;
162 m_motorTargetVelocity = targetVelocity;
163 m_maxMotorImpulse = maxMotorImpulse;
177#ifdef _BT_USE_CENTER_LIMIT_
178 m_limit.
set(low, high, _softness, _biasFactor, _relaxationFactor);
182 m_limitSoftness = _softness;
183 m_biasFactor = _biasFactor;
184 m_relaxationFactor = _relaxationFactor;
190#ifdef _BT_USE_CENTER_LIMIT_
193 return m_limitSoftness;
199#ifdef _BT_USE_CENTER_LIMIT_
208#ifdef _BT_USE_CENTER_LIMIT_
211 return m_relaxationFactor;
225 btVector3 axisInB = m_rbA.getCenterOfMassTransform().getBasis() * axisInA;
231 m_rbBFrame.
getOrigin() = m_rbB.getCenterOfMassTransform().inverse()(m_rbA.getCenterOfMassTransform()(pivotInA));
241#ifdef _BT_USE_CENTER_LIMIT_
244 return m_lowerLimit <= m_upperLimit;
250#ifdef _BT_USE_CENTER_LIMIT_
259#ifdef _BT_USE_CENTER_LIMIT_
281#ifdef _BT_USE_CENTER_LIMIT_
290#ifdef _BT_USE_CENTER_LIMIT_
299 return m_angularOnly;
303 return m_enableAngularMotor;
307 return m_motorTargetVelocity;
311 return m_maxMotorImpulse;
315 void setUseFrameOffset(
bool frameOffsetOnOff) { m_useOffsetForConstraintFrame = frameOffsetOnOff; }
322 virtual void setParam(
int num,
btScalar value,
int axis = -1);
324 virtual btScalar getParam(
int num,
int axis = -1)
const;
338#ifdef BT_BACKWARDS_COMPATIBLE_SERIALIZATION
370 :
btHingeConstraint(rbA, rbB, pivotInA, pivotInB, axisInA, axisInB, useReferenceFrameA)
372 m_accumulatedAngle = getHingeAngle();
378 m_accumulatedAngle = getHingeAngle();
384 m_accumulatedAngle = getHingeAngle();
390 m_accumulatedAngle = getHingeAngle();
392 btScalar getAccumulatedHingeAngle();
393 void setAccumulatedHingeAngle(
btScalar accAngle);
394 virtual void getInfo1(btConstraintInfo1 * info);
455#ifdef _BT_USE_CENTER_LIMIT_
462 hingeData->m_lowerLimit = float(m_lowerLimit);
463 hingeData->m_upperLimit = float(m_upperLimit);
464 hingeData->m_limitSoftness = float(m_limitSoftness);
465 hingeData->m_biasFactor = float(m_biasFactor);
466 hingeData->m_relaxationFactor = float(m_relaxationFactor);
470#ifdef BT_USE_DOUBLE_PRECISION
471 hingeData->m_padding1[0] = 0;
472 hingeData->m_padding1[1] = 0;
473 hingeData->m_padding1[2] = 0;
474 hingeData->m_padding1[3] = 0;
@ BT_HINGE_FLAGS_CFM_STOP
@ BT_HINGE_FLAGS_CFM_NORM
@ BT_HINGE_FLAGS_ERP_NORM
@ BT_HINGE_FLAGS_ERP_STOP
#define btHingeConstraintData
#define btHingeConstraintDataName
btQuaternion shortestArcQuat(const btVector3 &v0, const btVector3 &v1)
btVector3 quatRotate(const btQuaternion &rotation, const btVector3 &v)
btScalar btNormalizeAngle(btScalar angleInRadians)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
#define ATTRIBUTE_ALIGNED16(a)
#define SIMD_FORCE_INLINE
void btPlaneSpace1(const T &n, T &p, T &q)
bool isLimit() const
Returns true when the last test() invocation recognized limit violation.
btScalar getBiasFactor() const
Returns limit's bias factor.
btScalar getSoftness() const
Returns limit's softness.
btScalar getSign() const
Returns sign value evaluated when test() was invoked.
void set(btScalar low, btScalar high, btScalar _softness=0.9f, btScalar _biasFactor=0.3f, btScalar _relaxationFactor=1.0f)
Sets all limit's parameters.
btScalar getHalfRange() const
Gives half of the distance between min and max limit angle.
btScalar getRelaxationFactor() const
Returns limit's relaxation factor.
The getAccumulatedHingeAngle returns the accumulated hinge angle, taking rotation across the -PI/PI b...
BT_DECLARE_ALIGNED_ALLOCATOR()
btScalar m_accumulatedAngle
btHingeAccumulatedAngleConstraint(btRigidBody &rbA, const btVector3 &pivotInA, const btVector3 &axisInA, bool useReferenceFrameA=false)
btHingeAccumulatedAngleConstraint(btRigidBody &rbA, btRigidBody &rbB, const btVector3 &pivotInA, const btVector3 &pivotInB, const btVector3 &axisInA, const btVector3 &axisInB, bool useReferenceFrameA=false)
btHingeAccumulatedAngleConstraint(btRigidBody &rbA, btRigidBody &rbB, const btTransform &rbAFrame, const btTransform &rbBFrame, bool useReferenceFrameA=false)
btHingeAccumulatedAngleConstraint(btRigidBody &rbA, const btTransform &rbAFrame, bool useReferenceFrameA=false)
hinge constraint between two rigidbodies each with a pivotpoint that descibes the axis location in lo...
const btRigidBody & getRigidBodyB() const
virtual int getFlags() const
btScalar m_maxMotorImpulse
btScalar m_accLimitImpulse
void setAngularOnly(bool angularOnly)
const btTransform & getAFrame() const
btScalar getUpperLimit() const
btScalar getLimitRelaxationFactor() const
BT_DECLARE_ALIGNED_ALLOCATOR()
void setUseReferenceFrameA(bool useReferenceFrameA)
btScalar m_accMotorImpulse
const btTransform & getBFrame() const
btScalar getLowerLimit() const
btTransform & getFrameOffsetA()
btScalar getLimitSoftness() const
bool m_useSolveConstraintObsolete
void setAxis(btVector3 &axisInA)
bool m_useOffsetForConstraintFrame
void setMotorTargetVelocity(btScalar motorTargetVelocity)
virtual int calculateSerializeBufferSize() const
btScalar getLimitBiasFactor() const
void setMaxMotorImpulse(btScalar maxMotorImpulse)
btRigidBody & getRigidBodyA()
void setLimit(btScalar low, btScalar high, btScalar _softness=0.9f, btScalar _biasFactor=0.3f, btScalar _relaxationFactor=1.0f)
void setUseFrameOffset(bool frameOffsetOnOff)
bool m_useReferenceFrameA
void enableAngularMotor(bool enableMotor, btScalar targetVelocity, btScalar maxMotorImpulse)
btScalar m_motorTargetVelocity
btTransform & getFrameOffsetB()
bool getUseReferenceFrameA() const
void enableMotor(bool enableMotor)
btTransform & getBFrame()
btScalar getMaxMotorImpulse()
bool m_enableAngularMotor
btScalar getMotorTargetVelocity()
btTransform & getAFrame()
const btRigidBody & getRigidBodyA() const
virtual const char * serialize(void *dataBuffer, btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
bool getEnableAngularMotor()
btRigidBody & getRigidBodyB()
Jacobian entry is an abstraction that allows to describe constraints it can be used in combination wi...
btMatrix3x3 inverse() const
Return the inverse of the matrix.
void setValue(const btScalar &xx, const btScalar &xy, const btScalar &xz, const btScalar &yx, const btScalar &yy, const btScalar &yz, const btScalar &zx, const btScalar &zy, const btScalar &zz)
Set the values of the matrix explicitly (row major)
The btQuaternion implements quaternion to perform linear algebra rotations in combination with btMatr...
The btRigidBody is the main class for rigid body objects.
virtual const char * serialize(void *dataBuffer, class btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
virtual int calculateSerializeBufferSize() const
TypedConstraint is the baseclass for Bullet constraints and vehicles.
virtual const char * serialize(void *dataBuffer, btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
btVector3 can be used to represent 3D points and vectors.
const btScalar & getZ() const
Return the z value.
btVector3 cross(const btVector3 &v) const
Return the cross product between this and another vector.
const btScalar & getY() const
Return the y value.
const btScalar & getX() const
Return the x value.
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
double m_motorTargetVelocity
btTypedConstraintDoubleData m_typeConstraintData
double m_relaxationFactor
btTransformDoubleData m_rbBFrame
btTransformDoubleData m_rbAFrame
this structure is not used, except for loading pre-2.82 .bullet files
float m_motorTargetVelocity
btTransformDoubleData m_rbAFrame
btTransformDoubleData m_rbBFrame
btTypedConstraintData m_typeConstraintData
btTypedConstraintData m_typeConstraintData
float m_motorTargetVelocity
btTransformFloatData m_rbAFrame
btTransformFloatData m_rbBFrame
this structure is not used, except for loading pre-2.82 .bullet files