16 #ifndef BT_RIGIDBODY_H
17 #define BT_RIGIDBODY_H
31 #ifdef BT_USE_DOUBLE_PRECISION
32 #define btRigidBodyData btRigidBodyDoubleData
33 #define btRigidBodyDataName "btRigidBodyDoubleData"
35 #define btRigidBodyData btRigidBodyFloatData
36 #define btRigidBodyDataName "btRigidBodyFloatData"
76 bool m_additionalDamping;
78 btScalar m_additionalLinearDampingThresholdSqr;
79 btScalar m_additionalAngularDampingThresholdSqr;
80 btScalar m_additionalAngularDampingFactor;
167 btRigidBody(
const btRigidBodyConstructionInfo& constructionInfo);
182 void setupRigidBody(
const btRigidBodyConstructionInfo& constructionInfo);
215 return m_gravity_acceleration;
232 return m_linearSleepingThreshold;
237 return m_angularSleepingThreshold;
267 return m_invInertiaTensorWorld;
286 return m_totalTorque;
291 return m_invInertiaLocal;
296 m_invInertiaLocal = diagInvInertia;
301 m_linearSleepingThreshold = linear;
302 m_angularSleepingThreshold = angular;
308 #if defined(BT_CLAMP_VELOCITY_TO) && BT_CLAMP_VELOCITY_TO > 0
309 clampVelocity(m_totalTorque);
322 #if defined(BT_CLAMP_VELOCITY_TO) && BT_CLAMP_VELOCITY_TO > 0
330 #if defined(BT_CLAMP_VELOCITY_TO) && BT_CLAMP_VELOCITY_TO > 0
374 #if defined(BT_CLAMP_VELOCITY_TO) && BT_CLAMP_VELOCITY_TO > 0
377 fmax(-BT_CLAMP_VELOCITY_TO,
378 fmin(BT_CLAMP_VELOCITY_TO,
v.getX()))
381 fmax(-BT_CLAMP_VELOCITY_TO,
382 fmin(BT_CLAMP_VELOCITY_TO,
v.getY()))
385 fmax(-BT_CLAMP_VELOCITY_TO,
386 fmin(BT_CLAMP_VELOCITY_TO,
v.getZ()))
394 #if defined(BT_CLAMP_VELOCITY_TO) && BT_CLAMP_VELOCITY_TO > 0
402 #if defined(BT_CLAMP_VELOCITY_TO) && BT_CLAMP_VELOCITY_TO > 0
410 #if defined(BT_CLAMP_VELOCITY_TO) && BT_CLAMP_VELOCITY_TO > 0
446 #if defined(BT_CLAMP_VELOCITY_TO) && BT_CLAMP_VELOCITY_TO > 0
455 #if defined(BT_CLAMP_VELOCITY_TO) && BT_CLAMP_VELOCITY_TO > 0
490 return m_inverseMass +
normal.dot(vec);
496 return axis.dot(vec);
551 return m_optionalMotionState;
555 return m_optionalMotionState;
559 m_optionalMotionState = motionState;
560 if (m_optionalMotionState)
595 return m_constraintRefs[index];
600 return m_constraintRefs.
size();
605 m_rigidbodyFlags = flags;
610 return m_rigidbodyFlags;
ATTR_WARN_UNUSED_RESULT const BMVert * v
#define DISABLE_DEACTIVATION
btScalar m_deactivationTime
void setActivationState(int newState) const
SIMD_FORCE_INLINE int getActivationState() const
#define WANTS_DEACTIVATION
int m_updateRevision
internal update revision number. It will be increased when the object changes. This allows some subsy...
btCollisionShape * m_collisionShape
btBroadphaseProxy * m_broadphaseHandle
btCollisionShape
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
btScalar m_angularDamping
btMatrix3x3
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
bool gDisableDeactivation
btScalar gDeactivationTime
@ BT_ENABLE_GYROPSCOPIC_FORCE
@ BT_DISABLE_WORLD_GRAVITY
@ BT_ENABLE_GYROSCOPIC_FORCE_IMPLICIT_BODY
@ BT_ENABLE_GYROSCOPIC_FORCE_EXPLICIT
@ BT_ENABLE_GYROSCOPIC_FORCE_IMPLICIT_WORLD
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
#define SIMD_FORCE_INLINE
btTransform m_worldTransform
btVector3 m_deltaLinearVelocity
btVector3 m_angularVelocity
btVector3 m_linearVelocity
btTypedConstraint(btTypedConstraintType type, btRigidBody &rbA)
SIMD_FORCE_INLINE btScalar length2() const
Return the length of the vector squared.
btVector3
btVector3 can be used to represent 3D points and vectors. It has an un-used w component to suit 16-by...
SIMD_FORCE_INLINE int size() const
return the number of elements in the array
virtual void getWorldTransform(btTransform &worldTrans) const =0
The btQuaternion implements quaternion to perform linear algebra rotations in combination with btMatr...
void applyTorqueImpulse(const btVector3 &torque)
void setLinearFactor(const btVector3 &linearFactor)
void getAabb(btVector3 &aabbMin, btVector3 &aabbMax) const
const btVector3 & getGravity() const
SIMD_FORCE_INLINE const btCollisionShape * getCollisionShape() const
const btVector3 & getAngularVelocity() const
void integrateVelocities(btScalar step)
SIMD_FORCE_INLINE btScalar computeAngularImpulseDenominator(const btVector3 &axis) const
btVector3 getVelocityInLocalPoint(const btVector3 &rel_pos) const
void addConstraintRef(btTypedConstraint *c)
virtual void serializeSingleObject(class btSerializer *serializer) const
void setNewBroadphaseProxy(btBroadphaseProxy *broadphaseProxy)
ATTRIBUTE_ALIGNED16(btVector3 m_deltaLinearVelocity)
btMotionState * getMotionState()
btScalar getLinearSleepingThreshold() const
static btRigidBody * upcast(btCollisionObject *colObj)
const btVector3 & getLinearFactor() const
void applyDamping(btScalar timeStep)
applyDamping damps the velocity, using the given m_linearDamping and m_angularDamping
void applyCentralForce(const btVector3 &force)
btScalar getInvMass() const
SIMD_FORCE_INLINE btCollisionShape * getCollisionShape()
btScalar getAngularDamping() const
virtual const char * serialize(void *dataBuffer, class btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
btBroadphaseProxy * getBroadphaseProxy()
virtual int calculateSerializeBufferSize() const
static const btRigidBody * upcast(const btCollisionObject *colObj)
void setGravity(const btVector3 &acceleration)
const btMotionState * getMotionState() const
const btVector3 & getTotalTorque() const
btRigidBody(const btRigidBodyConstructionInfo &constructionInfo)
btRigidBody constructor using construction info
btQuaternion getOrientation() const
void proceedToTransform(const btTransform &newTrans)
void saveKinematicState(btScalar step)
btVector3 getLocalInertia() const
btVector3 computeGyroscopicImpulseImplicit_World(btScalar dt) const
perform implicit force computation in world space
const btBroadphaseProxy * getBroadphaseProxy() const
btVector3 m_angularFactor
btVector3 computeGyroscopicImpulseImplicit_Body(btScalar step) const
perform implicit force computation in body space (inertial frame)
void applyImpulse(const btVector3 &impulse, const btVector3 &rel_pos)
void applyCentralImpulse(const btVector3 &impulse)
void setTurnVelocity(const btVector3 &v)
SIMD_FORCE_INLINE btScalar computeImpulseDenominator(const btVector3 &pos, const btVector3 &normal) const
int getNumConstraintRefs() const
void removeConstraintRef(btTypedConstraint *c)
btVector3 getPushVelocityInLocalPoint(const btVector3 &rel_pos) const
void setSleepingThresholds(btScalar linear, btScalar angular)
void setMassProps(btScalar mass, const btVector3 &inertia)
btVector3 m_deltaAngularVelocity
const btTransform & getCenterOfMassTransform() const
const btVector3 & getLinearVelocity() const
btScalar getAngularSleepingThreshold() const
void setAngularFactor(const btVector3 &angFac)
void applyTorqueTurnImpulse(const btVector3 &torque)
SIMD_FORCE_INLINE bool wantsSleeping()
SIMD_FORCE_INLINE void updateDeactivation(btScalar timeStep)
const btVector3 & getCenterOfMassPosition() const
const btVector3 & getTotalForce() const
const btMatrix3x3 & getInvInertiaTensorWorld() const
btScalar getLinearDamping() const
btTypedConstraint * getConstraintRef(int index)
void setInvInertiaDiagLocal(const btVector3 &diagInvInertia)
void setAngularVelocity(const btVector3 &ang_vel)
void setMotionState(btMotionState *motionState)
void translate(const btVector3 &v)
void setPushVelocity(const btVector3 &v)
void applyCentralPushImpulse(const btVector3 &impulse)
void setDamping(btScalar lin_damping, btScalar ang_damping)
void setAngularFactor(btScalar angFac)
void setLinearVelocity(const btVector3 &lin_vel)
void applyPushImpulse(const btVector3 &impulse, const btVector3 &rel_pos)
void setupRigidBody(const btRigidBodyConstructionInfo &constructionInfo)
setupRigidBody is only used internally by the constructor
void setCenterOfMassTransform(const btTransform &xform)
const btVector3 & getAngularFactor() const
const btVector3 & getInvInertiaDiagLocal() const
void updateInertiaTensor()
void applyTorque(const btVector3 &torque)
void applyForce(const btVector3 &force, const btVector3 &rel_pos)
btVector3 getPushVelocity() const
btVector3 getTurnVelocity() const
void predictIntegratedTransform(btScalar step, btTransform &predictedTransform)
continuous collision detection needs prediction
btVector3 computeGyroscopicForceExplicit(btScalar maxGyroscopicForce) const
explicit version is best avoided, it gains energy
IconTextureDrawCall normal
vec_base< T, 3 > cross(const vec_base< T, 3 > &a, const vec_base< T, 3 > &b)
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_angularVelocity
btCollisionObjectDoubleData m_collisionObjectData
btVector3DoubleData m_totalForce
btVector3DoubleData m_linearFactor
btVector3DoubleData m_invInertiaLocal
btVector3DoubleData m_totalTorque
double m_additionalLinearDampingThresholdSqr
btVector3DoubleData m_angularFactor
btMatrix3x3DoubleData m_invInertiaTensorWorld
double m_angularSleepingThreshold
btVector3DoubleData m_linearVelocity
double m_additionalAngularDampingThresholdSqr
btVector3DoubleData m_gravity
double m_additionalAngularDampingFactor
double m_linearSleepingThreshold
double m_additionalDampingFactor
btVector3DoubleData m_gravity_acceleration
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
btVector3FloatData m_totalTorque
btVector3FloatData m_linearFactor
btVector3FloatData m_totalForce
btVector3FloatData m_angularVelocity
btVector3FloatData m_angularFactor
btVector3FloatData m_invInertiaLocal
btMatrix3x3FloatData m_invInertiaTensorWorld
float m_additionalLinearDampingThresholdSqr
float m_additionalAngularDampingFactor
btCollisionObjectFloatData m_collisionObjectData
btVector3FloatData m_linearVelocity
float m_angularSleepingThreshold
btVector3FloatData m_gravity
float m_additionalDampingFactor
btVector3FloatData m_gravity_acceleration
float m_linearSleepingThreshold
float m_additionalAngularDampingThresholdSqr
btScalar m_friction
best simulation results when friction is non-zero
btRigidBodyConstructionInfo(btScalar mass, btMotionState *motionState, btCollisionShape *collisionShape, const btVector3 &localInertia=btVector3(0, 0, 0))
btScalar m_linearSleepingThreshold
btScalar m_spinningFriction
btScalar m_restitution
best simulation results using zero restitution.
btMotionState * m_motionState
btScalar m_additionalAngularDampingFactor
btScalar m_additionalLinearDampingThresholdSqr
btScalar m_angularDamping
btScalar m_rollingFriction
btScalar m_additionalDampingFactor
btScalar m_angularSleepingThreshold
btCollisionShape * m_collisionShape
btTransform m_startWorldTransform
btScalar m_additionalAngularDampingThresholdSqr