34#ifdef BT_USE_DOUBLE_PRECISION
35#define btMultiBodyData btMultiBodyDoubleData
36#define btMultiBodyDataName "btMultiBodyDoubleData"
37#define btMultiBodyLinkData btMultiBodyLinkDoubleData
38#define btMultiBodyLinkDataName "btMultiBodyLinkDoubleData"
40#define btMultiBodyData btMultiBodyFloatData
41#define btMultiBodyDataName "btMultiBodyFloatData"
42#define btMultiBodyLinkData btMultiBodyLinkFloatData
43#define btMultiBodyLinkDataName "btMultiBodyLinkFloatData"
63 bool canSleep,
bool deprecatedMultiDof =
true);
68 void setupFixed(
int i,
73 const btVector3 &parentComToThisPivotOffset,
74 const btVector3 &thisPivotToThisComOffset,
bool deprecatedDisableParentCollision =
true);
76 void setupPrismatic(
int i,
82 const btVector3 &parentComToThisPivotOffset,
83 const btVector3 &thisPivotToThisComOffset,
84 bool disableParentCollision);
86 void setupRevolute(
int i,
92 const btVector3 &parentComToThisPivotOffset,
93 const btVector3 &thisPivotToThisComOffset,
94 bool disableParentCollision =
false);
96 void setupSpherical(
int i,
101 const btVector3 &parentComToThisPivotOffset,
102 const btVector3 &thisPivotToThisComOffset,
103 bool disableParentCollision =
false);
105 void setupPlanar(
int i,
111 const btVector3 &parentComToThisComOffset,
112 bool disableParentCollision =
false);
116 return m_links[index];
121 return m_links[index];
126 m_baseCollider = collider;
130 return m_baseCollider;
134 return m_baseCollider;
139 if (index >= 0 && index < getNumLinks())
141 return getLink(index).m_collider;
148 if (index >= 0 && index < getNumLinks())
150 return getLink(index).m_collider;
160 int getParent(
int link_num)
const;
172 const btVector3 &getLinkInertia(
int i)
const;
191 return btVector3(m_realBuf[3], m_realBuf[4], m_realBuf[5]);
200 return m_basePos_interpolate;
204 return m_baseQuat_interpolate;
213 if(!isBaseKinematic())
214 m_basePos_interpolate = pos;
219 m_basePos_interpolate = pos;
252 m_realBuf[3] = vel[0];
253 m_realBuf[4] = vel[1];
254 m_realBuf[5] = vel[2];
260 if(!isBaseKinematic())
261 m_baseQuat_interpolate = rot;
266 m_baseQuat_interpolate = rot;
271 m_realBuf[0] = omega[0];
272 m_realBuf[1] = omega[1];
273 m_realBuf[2] = omega[2];
276 void saveKinematicState(
btScalar timeStep);
285 btScalar *getJointVelMultiDof(
int i);
286 btScalar *getJointPosMultiDof(
int i);
288 const btScalar *getJointVelMultiDof(
int i)
const;
289 const btScalar *getJointPosMultiDof(
int i)
const;
291 void setJointPos(
int i,
btScalar q);
292 void setJointVel(
int i,
btScalar qdot);
293 void setJointPosMultiDof(
int i,
const double *q);
294 void setJointVelMultiDof(
int i,
const double *qdot);
295 void setJointPosMultiDof(
int i,
const float *q);
296 void setJointVelMultiDof(
int i,
const float *qdot);
304 return &m_realBuf[0];
327 const btVector3 &getRVector(
int i)
const;
329 const btVector3 &getInterpolateRVector(
int i)
const;
330 const btQuaternion &getInterpolateParentToLocalRot(
int i)
const;
350 void clearForcesAndTorques();
351 void clearConstraintForces();
353 void clearVelocities();
360 void addLinkForce(
int i,
const btVector3 &f);
361 void addLinkTorque(
int i,
const btVector3 &t);
365 m_baseConstraintForce += f;
368 void addLinkConstraintForce(
int i,
const btVector3 &f);
369 void addLinkConstraintTorque(
int i,
const btVector3 &t);
371 void addJointTorque(
int i,
btScalar Q);
372 void addJointTorqueMultiDof(
int i,
int dof,
btScalar Q);
373 void addJointTorqueMultiDof(
int i,
const btScalar *Q);
377 const btVector3 &getLinkForce(
int i)
const;
378 const btVector3 &getLinkTorque(
int i)
const;
379 btScalar getJointTorque(
int i)
const;
380 btScalar *getJointTorqueMultiDof(
int i);
399 void computeAccelerationsArticulatedBodyAlgorithmMultiDof(
btScalar dt,
403 bool isConstraintPass,
404 bool jointFeedbackInWorldSpace,
405 bool jointFeedbackInJointFrame
430 for (
int dof = 0; dof < 6 + getNumDofs(); ++dof)
432 m_deltaV[dof] += delta_vee[dof] * multiplier;
437 for (
int dof = 0; dof < 6 + getNumDofs(); ++dof)
439 m_splitV[dof] += delta_vee[dof] * multiplier;
444 applyDeltaVeeMultiDof(&m_splitV[0], 1);
448 applyDeltaVeeMultiDof(&m_splitV[0], -1);
450 for (
int dof = 0; dof < 6 + getNumDofs(); ++dof)
457 applyDeltaVeeMultiDof(&m_deltaV[0], 1);
459 for (
int dof = 0; dof < 6 + getNumDofs(); ++dof)
483 for (
int dof = 0; dof < 6 + getNumDofs(); ++dof)
485 m_realBuf[dof] += delta_vee[dof] * multiplier;
486 btClamp(m_realBuf[dof], -m_maxCoordinateVelocity, m_maxCoordinateVelocity);
494 void predictPositionsMultiDof(
btScalar dt);
514 void fillConstraintJacobianMultiDof(
int link,
530 m_canSleep = canSleep;
546 m_canWakeup = canWakeup;
554 void checkMotionAndSleepIfRequired(
btScalar timestep);
556 bool hasFixedBase()
const;
558 bool isBaseKinematic()
const;
560 bool isBaseStaticOrKinematic()
const;
563 void setBaseDynamicType(
int dynamicType);
567 m_fixedBase = fixedBase;
586 m_links.resize(numLinks);
591 return m_linearDamping;
595 m_linearDamping = damp;
599 return m_angularDamping;
603 m_angularDamping = damp;
608 return m_useGyroTerm;
612 m_useGyroTerm = useGyro;
616 return m_maxCoordinateVelocity;
620 m_maxCoordinateVelocity = maxVel;
625 return m_maxAppliedImpulse;
629 m_maxAppliedImpulse = maxImp;
633 m_hasSelfCollision = hasSelfCollision;
637 return m_hasSelfCollision;
640 void finalizeMultiDof();
653 __posUpdated = updated;
659 return m_internalNeedsJointFeedback;
715 static void spatialTransform(
const btMatrix3x3 &rotation_matrix,
722 void setLinkDynamicType(
const int i,
int type);
724 bool isLinkStaticOrKinematic(
const int i)
const;
726 bool isLinkKinematic(
const int i)
const;
728 bool isLinkAndAllAncestorsStaticOrKinematic(
const int i)
const;
730 bool isLinkAndAllAncestorsKinematic(
const int i)
const;
734 m_sleepEpsilon = sleepThreshold;
739 this->m_sleepTimeout = sleepTimeout;
752 int dofOffset = 0, cfgOffset = 0;
753 for (
int bidx = 0; bidx < m_links.size(); ++bidx)
755 m_links[bidx].m_dofOffset = dofOffset;
756 m_links[bidx].m_cfgOffset = cfgOffset;
757 dofOffset += m_links[bidx].m_dofCount;
758 cfgOffset += m_links[bidx].m_posVarCount;
762 void mulMatrix(
const btScalar *pA,
const btScalar *pB,
int rowsA,
int colsA,
int rowsB,
int colsB,
btScalar *pC)
const;
void btClamp(T &a, const T &lb, const T &ub)
btQuaternion inverse(const btQuaternion &q)
Return the inverse of a quaternion.
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
#define ATTRIBUTE_ALIGNED16(a)
void * m_userObjectPointer
users can point to their objects, m_userPointer is not used by Bullet, see setUserPointer/getUserPoin...
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
virtual int calculateSerializeBufferSize() const
virtual const char * serialize(void *dataBuffer, class btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
btScalar m_maxCoordinateVelocity
void useRK4Integration(bool use)
void setMaxCoordinateVelocity(btScalar maxVel)
btTransform getInterpolateBaseWorldTransform() const
const btVector3 & getInterpolateBasePos() const
void setMaxAppliedImpulse(btScalar maxImp)
void applyDeltaSplitVeeMultiDof(const btScalar *delta_vee, btScalar multiplier)
btAlignedObjectArray< btMultibodyLink > m_links
btAlignedObjectArray< btMatrix3x3 > m_matrixBuf
btMultiBodyLinkCollider * m_baseCollider
void fillContactJacobianMultiDof(int link, const btVector3 &contact_point, const btVector3 &normal, btScalar *jac, btAlignedObjectArray< btScalar > &scratch_r, btAlignedObjectArray< btVector3 > &scratch_v, btAlignedObjectArray< btMatrix3x3 > &scratch_m) const
bool getUseGyroTerm() const
const btVector3 & getBasePos() const
bool getCanWakeup() const
void setCanSleep(bool canSleep)
void setUseGyroTerm(bool useGyro)
int getCompanionId() const
btScalar getAngularDamping() const
int getUserIndex2() const
btVector3 m_basePos_interpolate
btAlignedObjectArray< btVector3 > m_vectorBuf
void addBaseConstraintForce(const btVector3 &f)
btScalar m_maxAppliedImpulse
void setBaseMass(btScalar mass)
void setBaseInertia(const btVector3 &inertia)
btScalar m_angularDamping
const btScalar * getDeltaVelocityVector() const
void setHasSelfCollision(bool hasSelfCollision)
void * m_userObjectPointer
void setLinearDamping(btScalar damp)
const btMultiBodyLinkCollider * getLinkCollider(int index) const
bool hasSelfCollision() const
void setUserIndex2(int index)
void setBaseVel(const btVector3 &vel)
btMatrix3x3 m_cachedInertiaLowerRight
void setBaseOmega(const btVector3 &omega)
void addBaseTorque(const btVector3 &t)
void useGlobalVelocities(bool use)
btMultiBodyLinkCollider * getLinkCollider(int index)
BT_DECLARE_ALIGNED_ALLOCATOR()
btAlignedObjectArray< btScalar > m_realBuf
btVector3 m_baseConstraintTorque
void operator=(const btMultiBody &)
void setBaseName(const char *name)
memory of setBaseName needs to be manager by user
const btMultibodyLink & getLink(int index) const
btVector3 getBaseOmega() const
btQuaternion m_baseQuat_interpolate
void setSleepTimeout(btScalar sleepTimeout)
void setBasePos(const btVector3 &pos)
const btVector3 & getBaseTorque() const
bool m_useGlobalVelocities
bool isUsingGlobalVelocities() const
btMatrix3x3 m_cachedInertiaLowerLeft
void setInterpolateBaseWorldTransform(const btTransform &tr)
void * getUserPointer() const
users can point to their objects, userPointer is not used by Bullet
void setInterpolateBasePos(const btVector3 &pos)
void setAngularDamping(btScalar damp)
const char * getBaseName() const
const btVector3 & getBaseForce() const
void setUserPointer(void *userPointer)
users can point to their objects, userPointer is not used by Bullet
const btQuaternion & getInterpolateWorldToBaseRot() const
void processDeltaVeeMultiDof2()
void setPosUpdated(bool updated)
btScalar getMaxAppliedImpulse() const
btMatrix3x3 m_cachedInertiaTopLeft
bool isUsingRK4Integration() const
bool m_cachedInertiaValid
const btMultiBodyLinkCollider * getBaseCollider() const
bool internalNeedsJointFeedback() const
const btScalar * getSplitVelocityVector() const
void setNumLinks(int numLinks)
void setSleepThreshold(btScalar sleepThreshold)
btTransform getBaseWorldTransform() const
btScalar getLinearDamping() const
void setCanWakeup(bool canWakeup)
bool m_kinematic_calculate_velocity
btMatrix3x3 m_cachedInertiaTopRight
btScalar getBaseMass() const
void setFixedBase(bool fixedBase)
btScalar getMaxCoordinateVelocity() const
btAlignedObjectArray< btScalar > m_deltaV
int getNumPosVars() const
void updateLinksDofOffsets()
void addBaseConstraintTorque(const btVector3 &t)
bool isPosUpdated() const
bool m_internalNeedsJointFeedback
the m_needsJointFeedback gets updated/computed during the stepVelocitiesMultiDof and it for internal ...
btAlignedObjectArray< btScalar > m_splitV
const btVector3 & getBaseInertia() const
const btQuaternion & getWorldToBaseRot() const
btVector3 m_baseConstraintForce
void setInterpolateWorldToBaseRot(const btQuaternion &rot)
void setWorldToBaseRot(const btQuaternion &rot)
void setCompanionId(int id)
btMultiBody(const btMultiBody &)
btMultibodyLink & getLink(int index)
btMultiBodyLinkCollider * getBaseCollider()
void applyDeltaVeeMultiDof(const btScalar *delta_vee, btScalar multiplier)
const btVector3 getBaseVel() const
void addBaseForce(const btVector3 &f)
void applyDeltaVeeMultiDof2(const btScalar *delta_vee, btScalar multiplier)
void setUserIndex(int index)
users can point to their objects, userPointer is not used by Bullet
const btScalar * getVelocityVector() const
void setBaseCollider(btMultiBodyLinkCollider *collider)
void setBaseWorldTransform(const btTransform &tr)
The btQuaternion implements quaternion to perform linear algebra rotations in combination with btMatr...
btQuaternion inverse() const
Return the inverse of this quaternion.
btVector3 can be used to represent 3D points and vectors.
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
btVector3DoubleData m_baseWorldPosition
btVector3DoubleData m_baseInertia
btVector3DoubleData m_baseLinearVelocity
btCollisionObjectDoubleData * m_baseCollider
btVector3DoubleData m_baseAngularVelocity
btQuaternionDoubleData m_baseWorldOrientation
btMultiBodyLinkDoubleData * m_links
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
btCollisionObjectFloatData * m_baseCollider
btQuaternionFloatData m_baseWorldOrientation
btVector3FloatData m_baseInertia
btVector3FloatData m_baseAngularVelocity
btVector3FloatData m_baseLinearVelocity
btMultiBodyLinkFloatData * m_links
btVector3FloatData m_baseWorldPosition
btQuaternionDoubleData m_zeroRotParentToThis
btVector3DoubleData m_absFrameLocVelocityBottom
btCollisionObjectDoubleData * m_linkCollider
btVector3DoubleData m_jointAxisBottom[6]
btVector3DoubleData m_thisPivotToThisComOffset
btVector3DoubleData m_absFrameTotVelocityTop
btVector3DoubleData m_parentComToThisPivotOffset
btVector3DoubleData m_jointAxisTop[6]
btVector3DoubleData m_absFrameTotVelocityBottom
btVector3DoubleData m_absFrameLocVelocityTop
double m_jointMaxVelocity
btVector3DoubleData m_linkInertia
btCollisionObjectFloatData * m_linkCollider
btVector3FloatData m_absFrameLocVelocityTop
btQuaternionFloatData m_zeroRotParentToThis
btVector3FloatData m_absFrameTotVelocityBottom
btVector3FloatData m_jointAxisBottom[6]
btVector3FloatData m_parentComToThisPivotOffset
btVector3FloatData m_absFrameLocVelocityBottom
btVector3FloatData m_linkInertia
btVector3FloatData m_thisPivotToThisComOffset
btVector3FloatData m_absFrameTotVelocityTop
btVector3FloatData m_jointAxisTop[6]
These spatial algebra classes are used for btMultiBody, see BulletDynamics/Featherstone.