24 #ifndef BT_MULTIBODY_H
25 #define BT_MULTIBODY_H
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);
73 const btVector3 &parentComToThisPivotOffset,
74 const btVector3 &thisPivotToThisComOffset,
bool deprecatedDisableParentCollision =
true);
82 const btVector3 &parentComToThisPivotOffset,
83 const btVector3 &thisPivotToThisComOffset,
84 bool disableParentCollision);
92 const btVector3 &parentComToThisPivotOffset,
93 const btVector3 &thisPivotToThisComOffset,
94 bool disableParentCollision =
false);
101 const btVector3 &parentComToThisPivotOffset,
102 const btVector3 &thisPivotToThisComOffset,
103 bool disableParentCollision =
false);
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;
191 return btVector3(m_realBuf[3], m_realBuf[4], m_realBuf[5]);
200 return m_basePos_interpolate;
204 return m_baseQuat_interpolate;
213 m_basePos_interpolate =
pos;
232 m_realBuf[3] = vel[0];
233 m_realBuf[4] = vel[1];
234 m_realBuf[5] = vel[2];
239 m_baseQuat_interpolate =
rot;
243 m_realBuf[0] = omega[0];
244 m_realBuf[1] = omega[1];
245 m_realBuf[2] = omega[2];
274 return &m_realBuf[0];
335 m_baseConstraintForce += f;
373 bool isConstraintPass,
374 bool jointFeedbackInWorldSpace,
375 bool jointFeedbackInJointFrame
400 for (
int dof = 0; dof < 6 +
getNumDofs(); ++dof)
402 m_deltaV[dof] += delta_vee[dof] * multiplier;
407 for (
int dof = 0; dof < 6 +
getNumDofs(); ++dof)
409 m_splitV[dof] += delta_vee[dof] * multiplier;
420 for (
int dof = 0; dof < 6 +
getNumDofs(); ++dof)
429 for (
int dof = 0; dof < 6 +
getNumDofs(); ++dof)
453 for (
int dof = 0; dof < 6 +
getNumDofs(); ++dof)
455 m_realBuf[dof] += delta_vee[dof] * multiplier;
456 btClamp(m_realBuf[dof], -m_maxCoordinateVelocity, m_maxCoordinateVelocity);
500 m_canSleep = canSleep;
516 m_canWakeup = canWakeup;
530 m_fixedBase = fixedBase;
545 m_links.resize(numLinks);
567 return m_useGyroTerm;
571 m_useGyroTerm = useGyro;
575 return m_maxCoordinateVelocity;
579 m_maxCoordinateVelocity = maxVel;
596 return m_hasSelfCollision;
612 __posUpdated = updated;
618 return m_internalNeedsJointFeedback;
690 void updateLinksDofOffsets()
692 int dofOffset = 0, cfgOffset = 0;
693 for (
int bidx = 0; bidx < m_links.size(); ++bidx)
695 m_links[bidx].m_dofOffset = dofOffset;
696 m_links[bidx].m_cfgOffset = cfgOffset;
697 dofOffset += m_links[bidx].m_dofCount;
698 cfgOffset += m_links[bidx].m_posVarCount;
706 const char *m_baseName;
749 bool m_cachedInertiaValid;
769 bool m_hasSelfCollision;
772 int m_dofCount, m_posVarCnt;
774 bool m_useRK4, m_useGlobalVelocities;
779 bool m_internalNeedsJointFeedback;
782 struct btMultiBodyLinkDoubleData
802 double m_jointPos[7];
803 double m_jointVel[6];
804 double m_jointTorque[6];
806 double m_jointDamping;
807 double m_jointFriction;
808 double m_jointLowerLimit;
809 double m_jointUpperLimit;
810 double m_jointMaxForce;
811 double m_jointMaxVelocity;
819 struct btMultiBodyLinkFloatData
839 float m_jointTorque[6];
841 float m_jointDamping;
842 float m_jointFriction;
843 float m_jointLowerLimit;
844 float m_jointUpperLimit;
845 float m_jointMaxForce;
846 float m_jointMaxVelocity;
855 struct btMultiBodyDoubleData
867 btMultiBodyLinkDoubleData *m_links;
872 struct btMultiBodyFloatData
884 btMultiBodyLinkFloatData *m_links;
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
void * m_userObjectPointer
users can point to their objects, m_userPointer is not used by Bullet, see setUserPointer/getUserPoin...
btGeneric6DofConstraint & operator=(btGeneric6DofConstraint &other)
btScalar m_angularDamping
btMatrix3x3 inverse() const
Return the inverse of the matrix.
btMatrix3x3
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
SIMD_FORCE_INLINE void btClamp(T &a, const T &lb, const T &ub)
btScalar m_maxAppliedImpulse
btScalar getMaxAppliedImpulse() const
void setupPrismatic(int i, btScalar mass, const btVector3 &inertia, int parent, const btQuaternion &rotParentToThis, const btVector3 &jointAxis, const btVector3 &parentComToThisPivotOffset, const btVector3 &thisPivotToThisComOffset, bool disableParentCollision)
bool getCanWakeup() const
void setUserPointer(void *userPointer)
users can point to their objects, userPointer is not used by Bullet
void setJointVelMultiDof(int i, const double *qdot)
const btVector3 & getLinkTorque(int i) const
void updateCollisionObjectInterpolationWorldTransforms(btAlignedObjectArray< btQuaternion > &world_to_local, btAlignedObjectArray< btVector3 > &local_origin)
const btScalar * getDeltaVelocityVector() const
bool isUsingGlobalVelocities() const
btScalar * getJointPosMultiDof(int i)
const btVector3 & getInterpolateBasePos() const
btScalar getBaseMass() const
bool getUseGyroTerm() const
int getCompanionId() const
bool internalNeedsJointFeedback() const
btMatrix3x3 localFrameToWorld(int i, const btMatrix3x3 &local_frame) const
void setBasePos(const btVector3 &pos)
void applyDeltaSplitVeeMultiDof(const btScalar *delta_vee, btScalar multiplier)
void setMaxAppliedImpulse(btScalar maxImp)
void processDeltaVeeMultiDof2()
virtual const char * serialize(void *dataBuffer, class btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
void setBaseCollider(btMultiBodyLinkCollider *collider)
bool isPosUpdated() const
virtual int calculateSerializeBufferSize() const
const btQuaternion & getInterpolateParentToLocalRot(int i) const
btScalar getAngularDamping() const
const btScalar * getSplitVelocityVector() const
const btVector3 & getBaseInertia() const
void useGlobalVelocities(bool use)
btVector3 worldDirToLocal(int i, const btVector3 &world_dir) const
btVector3 getBaseOmega() const
btScalar getJointPos(int i) const
const btVector3 & getLinkInertia(int i) const
void predictPositionsMultiDof(btScalar dt)
void addBaseForce(const btVector3 &f)
bool hasFixedBase() const
void setWorldToBaseRot(const btQuaternion &rot)
void applyDeltaVeeMultiDof(const btScalar *delta_vee, btScalar multiplier)
void computeAccelerationsArticulatedBodyAlgorithmMultiDof(btScalar dt, btAlignedObjectArray< btScalar > &scratch_r, btAlignedObjectArray< btVector3 > &scratch_v, btAlignedObjectArray< btMatrix3x3 > &scratch_m, bool isConstraintPass, bool jointFeedbackInWorldSpace, bool jointFeedbackInJointFrame)
const btVector3 getBaseVel() const
void addLinkConstraintForce(int i, const btVector3 &f)
void stepPositionsMultiDof(btScalar dt, btScalar *pq=0, btScalar *pqd=0)
bool isUsingRK4Integration() const
void addBaseConstraintForce(const btVector3 &f)
const btVector3 & getRVector(int i) const
void setLinearDamping(btScalar damp)
void setCanSleep(bool canSleep)
void calcAccelerationDeltasMultiDof(const btScalar *force, btScalar *output, btAlignedObjectArray< btScalar > &scratch_r, btAlignedObjectArray< btVector3 > &scratch_v) const
stepVelocitiesMultiDof is deprecated, use computeAccelerationsArticulatedBodyAlgorithmMultiDof instea...
btVector3 worldPosToLocal(int i, const btVector3 &world_pos) const
void setFixedBase(bool fixedBase)
void addLinkTorque(int i, const btVector3 &t)
void checkMotionAndSleepIfRequired(btScalar timestep)
btScalar * getJointTorqueMultiDof(int i)
void setAngularDamping(btScalar damp)
void setUserIndex(int index)
users can point to their objects, userPointer is not used by Bullet
const btVector3 & getInterpolateRVector(int i) const
const btQuaternion & getInterpolateWorldToBaseRot() const
void setBaseInertia(const btVector3 &inertia)
btScalar getLinkMass(int i) const
void setBaseVel(const btVector3 &vel)
const btMultiBodyLinkCollider * getLinkCollider(int index) const
void addLinkForce(int i, const btVector3 &f)
void forwardKinematics(btAlignedObjectArray< btQuaternion > &world_to_local, btAlignedObjectArray< btVector3 > &local_origin)
void addJointTorque(int i, btScalar Q)
void addBaseConstraintTorque(const btVector3 &t)
const btMultiBodyLinkCollider * getBaseCollider() const
const btMultibodyLink & getLink(int index) const
const btVector3 & getLinkForce(int i) const
btTransform getBaseWorldTransform() const
int getParent(int link_num) const
void addBaseTorque(const btVector3 &t)
void applyDeltaVeeMultiDof2(const btScalar *delta_vee, btScalar multiplier)
void setJointPosMultiDof(int i, const double *q)
void updateCollisionObjectWorldTransforms(btAlignedObjectArray< btQuaternion > &world_to_local, btAlignedObjectArray< btVector3 > &local_origin)
void setJointVel(int i, btScalar qdot)
int getNumPosVars() const
void * getUserPointer() const
users can point to their objects, userPointer is not used by Bullet
btScalar getJointTorque(int i) const
const btVector3 & getBaseForce() const
void setUserIndex2(int index)
void setCompanionId(int id)
void clearConstraintForces()
bool hasSelfCollision() const
void addLinkConstraintTorque(int i, const btVector3 &t)
void setBaseMass(btScalar mass)
void setupSpherical(int i, btScalar mass, const btVector3 &inertia, int parent, const btQuaternion &rotParentToThis, const btVector3 &parentComToThisPivotOffset, const btVector3 &thisPivotToThisComOffset, bool disableParentCollision=false)
void setJointPos(int i, btScalar q)
void setupPlanar(int i, btScalar mass, const btVector3 &inertia, int parent, const btQuaternion &rotParentToThis, const btVector3 &rotationAxis, const btVector3 &parentComToThisComOffset, bool disableParentCollision=false)
const btScalar * getVelocityVector() const
void setNumLinks(int numLinks)
static void spatialTransform(const btMatrix3x3 &rotation_matrix, const btVector3 &displacement, const btVector3 &top_in, const btVector3 &bottom_in, btVector3 &top_out, btVector3 &bottom_out)
void setBaseName(const char *name)
memory of setBaseName needs to be manager by user
void setCanWakeup(bool canWakeup)
void fillConstraintJacobianMultiDof(int link, const btVector3 &contact_point, const btVector3 &normal_ang, const btVector3 &normal_lin, btScalar *jac, btAlignedObjectArray< btScalar > &scratch_r, btAlignedObjectArray< btVector3 > &scratch_v, btAlignedObjectArray< btMatrix3x3 > &scratch_m) const
btVector3 localPosToWorld(int i, const btVector3 &local_pos) const
btScalar * getJointVelMultiDof(int i)
void setupRevolute(int i, btScalar mass, const btVector3 &inertia, int parentIndex, const btQuaternion &rotParentToThis, const btVector3 &jointAxis, const btVector3 &parentComToThisPivotOffset, const btVector3 &thisPivotToThisComOffset, bool disableParentCollision=false)
void useRK4Integration(bool use)
void setHasSelfCollision(bool hasSelfCollision)
const btVector3 & getBasePos() const
void setBaseWorldTransform(const btTransform &tr)
void setupFixed(int i, btScalar mass, const btVector3 &inertia, int parent, const btQuaternion &rotParentToThis, const btVector3 &parentComToThisPivotOffset, const btVector3 &thisPivotToThisComOffset, bool deprecatedDisableParentCollision=true)
void setPosUpdated(bool updated)
const btQuaternion & getWorldToBaseRot() const
const btQuaternion & getParentToLocalRot(int i) const
const char * getBaseName() const
void addJointTorqueMultiDof(int i, int dof, btScalar Q)
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
btVector3 localDirToWorld(int i, const btVector3 &local_dir) const
void setBaseOmega(const btVector3 &omega)
btScalar getJointVel(int i) const
const btVector3 & getBaseTorque() const
btScalar getMaxCoordinateVelocity() const
void setUseGyroTerm(bool useGyro)
int getUserIndex2() const
void setMaxCoordinateVelocity(btScalar maxVel)
void compTreeLinkVelocities(btVector3 *omega, btVector3 *vel) const
btScalar getLinearDamping() const
void clearForcesAndTorques()
#define BT_DECLARE_ALIGNED_ALLOCATOR()
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
#define ATTRIBUTE_ALIGNED16(a)
btVector3
btVector3 can be used to represent 3D points and vectors. It has an un-used w component to suit 16-by...
The btQuaternion implements quaternion to perform linear algebra rotations in combination with btMatr...
IconTextureDrawCall normal
ccl_global KernelShaderEvalInput ccl_global float * output
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
class btMultiBodyLinkCollider * m_collider