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);
177 btAssert(m_constraintRefs.size() == 0);
182 void setupRigidBody(
const btRigidBodyConstructionInfo& constructionInfo);
191 if (colObj->getInternalType() & btCollisionObject::CO_RIGID_BODY)
197 if (colObj->getInternalType() & btCollisionObject::CO_RIGID_BODY)
215 return m_gravity_acceleration;
222 return m_linearDamping;
227 return m_angularDamping;
232 return m_linearSleepingThreshold;
237 return m_angularSleepingThreshold;
256 return m_linearFactor;
260 m_linearFactor = linearFactor;
261 m_invMass = m_linearFactor * m_inverseMass;
267 return m_invInertiaTensorWorld;
276 m_totalForce += force * m_linearFactor;
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);
316 applyTorque(rel_pos.cross(force * m_linearFactor));
321 m_linearVelocity += impulse * m_linearFactor * m_inverseMass;
322 #if defined(BT_CLAMP_VELOCITY_TO) && BT_CLAMP_VELOCITY_TO > 0
323 clampVelocity(m_linearVelocity);
329 m_angularVelocity += m_invInertiaTensorWorld * torque *
m_angularFactor;
330 #if defined(BT_CLAMP_VELOCITY_TO) && BT_CLAMP_VELOCITY_TO > 0
331 clampVelocity(m_angularVelocity);
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
435 return m_linearVelocity;
439 return m_angularVelocity;
445 m_linearVelocity = lin_vel;
446 #if defined(BT_CLAMP_VELOCITY_TO) && BT_CLAMP_VELOCITY_TO > 0
447 clampVelocity(m_linearVelocity);
454 m_angularVelocity = ang_vel;
455 #if defined(BT_CLAMP_VELOCITY_TO) && BT_CLAMP_VELOCITY_TO > 0
456 clampVelocity(m_angularVelocity);
463 return m_linearVelocity + m_angularVelocity.cross(rel_pos);
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
virtual void getAabb(const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const
#define DISABLE_DEACTIVATION
btScalar m_deactivationTime
void setActivationState(int newState) const
SIMD_FORCE_INLINE int getActivationState() const
#define WANTS_DEACTIVATION
virtual void serializeSingleObject(class btSerializer *serializer) const
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...
void setDamping(btScalar damping)
virtual void saveKinematicState(btScalar timeStep)
virtual void applyGravity()
apply gravity, call this once per timestep
void setGravity(const btVector3 &gravity)
btMatrix3x3
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
unsigned calculateSerializeBufferSize() const
virtual bool serialize(void *o_alignedDataBuffer, unsigned i_dataBufferSize, bool i_swapEndian) const
Data buffer MUST be 16 byte aligned.
bool gDisableDeactivation
btScalar gDeactivationTime
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
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...
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 integrateVelocities(btScalar step)
SIMD_FORCE_INLINE btScalar computeAngularImpulseDenominator(const btVector3 &axis) const
btVector3 getVelocityInLocalPoint(const btVector3 &rel_pos) const
void addConstraintRef(btTypedConstraint *c)
void setNewBroadphaseProxy(btBroadphaseProxy *broadphaseProxy)
SIMD_FORCE_INLINE btCollisionShape * getCollisionShape()
const btVector3 & getTotalTorque() const
ATTRIBUTE_ALIGNED16(btVector3 m_deltaLinearVelocity)
const btVector3 & getGravity() const
btScalar getLinearSleepingThreshold() 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
btScalar getAngularDamping() const
const btVector3 & getLinearFactor() const
const btVector3 & getInvInertiaDiagLocal() const
btRigidBody(const btRigidBodyConstructionInfo &constructionInfo)
btRigidBody constructor using construction info
btQuaternion getOrientation() const
void proceedToTransform(const btTransform &newTrans)
const btTransform & getCenterOfMassTransform() const
btVector3 getLocalInertia() const
btVector3 computeGyroscopicImpulseImplicit_World(btScalar dt) const
perform implicit force computation in world space
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)
const btVector3 & getAngularVelocity() const
const btMotionState * getMotionState() const
btMotionState * getMotionState()
void setTurnVelocity(const btVector3 &v)
SIMD_FORCE_INLINE btScalar computeImpulseDenominator(const btVector3 &pos, const btVector3 &normal) const
int getNumConstraintRefs() const
static btRigidBody * upcast(btCollisionObject *colObj)
void removeConstraintRef(btTypedConstraint *c)
btVector3 getPushVelocityInLocalPoint(const btVector3 &rel_pos) const
void setSleepingThresholds(btScalar linear, btScalar angular)
void setMassProps(btScalar mass, const btVector3 &inertia)
const btVector3 & getCenterOfMassPosition() const
btVector3 m_deltaAngularVelocity
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)
btBroadphaseProxy * getBroadphaseProxy()
const btVector3 & getTotalForce() const
SIMD_FORCE_INLINE const btCollisionShape * getCollisionShape() const
btScalar getLinearDamping() const
const btVector3 & getAngularFactor() 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 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
const btBroadphaseProxy * getBroadphaseProxy() const
void setCenterOfMassTransform(const btTransform &xform)
static const btRigidBody * upcast(const btCollisionObject *colObj)
void updateInertiaTensor()
void applyTorque(const btVector3 &torque)
void applyForce(const btVector3 &force, const btVector3 &rel_pos)
btVector3 getPushVelocity() const
btVector3 getTurnVelocity() const
const btMatrix3x3 & getInvInertiaTensorWorld() 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
const btVector3 & getLinearVelocity() const
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
VecBase< float, 3 > cross(VecOp< float, 3 >, VecOp< float, 3 >) RET
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