16 #ifndef BT_RIGIDBODY_H 17 #define BT_RIGIDBODY_H 32 #ifdef BT_USE_DOUBLE_PRECISION 33 #define btRigidBodyData btRigidBodyDoubleData 34 #define btRigidBodyDataName "btRigidBodyDoubleData" 36 #define btRigidBodyData btRigidBodyFloatData 37 #define btRigidBodyDataName "btRigidBodyFloatData" 38 #endif //BT_USE_DOUBLE_PRECISION 154 m_motionState(motionState),
155 m_collisionShape(collisionShape),
156 m_localInertia(localInertia),
162 m_linearSleepingThreshold(
btScalar(0.8)),
163 m_angularSleepingThreshold(
btScalar(1.f)),
164 m_additionalDamping(false),
165 m_additionalDampingFactor(
btScalar(0.005)),
166 m_additionalLinearDampingThresholdSqr(
btScalar(0.01)),
167 m_additionalAngularDampingThresholdSqr(
btScalar(0.01)),
168 m_additionalAngularDampingFactor(
btScalar(0.01))
267 m_linearFactor = linearFactor;
301 m_invInertiaLocal = diagInvInertia;
306 m_linearSleepingThreshold = linear;
307 m_angularSleepingThreshold = angular;
328 m_angularVelocity += m_invInertiaTensorWorld * torque *
m_angularFactor;
370 m_linearVelocity = lin_vel;
376 m_angularVelocity = ang_vel;
382 return m_linearVelocity + m_angularVelocity.
cross(rel_pos);
408 return m_inverseMass + normal.
dot(vec);
415 return axis.
dot(vec);
423 if ((
getLinearVelocity().length2() < m_linearSleepingThreshold*m_linearSleepingThreshold) &&
424 (
getAngularVelocity().length2() < m_angularSleepingThreshold*m_angularSleepingThreshold))
481 m_optionalMotionState = motionState;
482 if (m_optionalMotionState)
493 m_angularFactor = angFac;
499 m_angularFactor.
setValue(angFac,angFac,angFac);
517 return m_constraintRefs[index];
522 return m_constraintRefs.
size();
527 m_rigidbodyFlags = flags;
615 #endif //BT_RIGIDBODY_H static const btRigidBody * upcast(const btCollisionObject *colObj)
to keep collision detection and dynamics separate we don't store a rigidbody pointer but a rigidbody ...
const btMotionState * getMotionState() const
btScalar m_additionalDampingFactor
btScalar getLinearDamping() const
btScalar computeAngularImpulseDenominator(const btVector3 &axis) const
btVector3FloatData m_gravity
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
void getAabb(btVector3 &aabbMin, btVector3 &aabbMax) const
btScalar computeImpulseDenominator(const btVector3 &pos, const btVector3 &normal) const
void translate(const btVector3 &v)
const btVector3 & getAngularVelocity() const
btScalar m_angularSleepingThreshold
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z)
const btVector3 & getTotalTorque() const
void applyTorqueImpulse(const btVector3 &torque)
btVector3 computeGyroscopicForceExplicit(btScalar maxGyroscopicForce) const
explicit version is best avoided, it gains energy
btVector3FloatData m_angularFactor
The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods It...
void predictIntegratedTransform(btScalar step, btTransform &predictedTransform)
continuous collision detection needs prediction
void updateInertiaTensor()
btScalar m_angularDamping
btVector3FloatData m_angularVelocity
const btTransform & getCenterOfMassTransform() const
bool gDisableDeactivation
btScalar getAngularSleepingThreshold() const
btVector3DoubleData m_totalForce
virtual int calculateSerializeBufferSize() const
btBroadphaseProxy * getBroadphaseProxy()
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
float m_additionalAngularDampingThresholdSqr
btVector3DoubleData m_gravity
#define SIMD_FORCE_INLINE
const btVector3 & getLinearFactor() const
double m_additionalDampingFactor
int getActivationState() const
btVector3DoubleData m_linearVelocity
btRigidBody(const btRigidBodyConstructionInfo &constructionInfo)
btRigidBody constructor using construction info
void setDamping(btScalar lin_damping, btScalar ang_damping)
btScalar m_angularSleepingThreshold
btQuaternion getOrientation() const
void setLinearFactor(const btVector3 &linearFactor)
float m_linearSleepingThreshold
btScalar m_additionalLinearDampingThresholdSqr
void setSleepingThresholds(btScalar linear, btScalar angular)
float m_additionalDampingFactor
btTransform m_worldTransform
const btVector3 & getAngularFactor() const
btScalar m_rollingFriction
the m_rollingFriction prevents rounded shapes, such as spheres, cylinders and capsules from rolling f...
float m_additionalLinearDampingThresholdSqr
btCollisionObjectFloatData m_collisionObjectData
btVector3DoubleData m_linearFactor
btVector3FloatData m_totalForce
const btCollisionShape * getCollisionShape() const
btScalar m_additionalLinearDampingThresholdSqr
void applyCentralForce(const btVector3 &force)
BT_ENABLE_GYROPSCOPIC_FORCE flags is enabled by default in Bullet 2.83 and onwards.
btScalar m_deactivationTime
void integrateVelocities(btScalar step)
void updateDeactivation(btScalar timeStep)
btVector3 m_invInertiaLocal
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
btVector3 computeGyroscopicImpulseImplicit_World(btScalar dt) const
perform implicit force computation in world space
double m_additionalAngularDampingFactor
btVector3 m_deltaLinearVelocity
void applyTorque(const btVector3 &torque)
const btVector3 & getInvInertiaDiagLocal() const
btScalar gDeactivationTime
const btVector3 & getLinearVelocity() const
void setupRigidBody(const btRigidBodyConstructionInfo &constructionInfo)
setupRigidBody is only used internally by the constructor
btMatrix3x3DoubleData m_invInertiaTensorWorld
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
void addConstraintRef(btTypedConstraint *c)
btScalar getInvMass() const
const btBroadphaseProxy * getBroadphaseProxy() const
btVector3 cross(const btVector3 &v) const
Return the cross product between this and another vector.
btScalar dot(const btVector3 &v) const
Return the dot product.
btCollisionShape * getCollisionShape()
float m_additionalAngularDampingFactor
btMotionState * m_optionalMotionState
btScalar m_restitution
best simulation results using zero restitution.
btCollisionObject can be used to manage collision detection objects.
btScalar m_linearSleepingThreshold
void setLinearVelocity(const btVector3 &lin_vel)
The btRigidBody is the main class for rigid body objects.
btScalar getLinearSleepingThreshold() const
btVector3 m_angularFactor
btVector3DoubleData m_invInertiaLocal
The btRigidBodyConstructionInfo structure provides information to create a rigid body.
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
btVector3 m_angularVelocity
btVector3DoubleData m_angularFactor
void proceedToTransform(const btTransform &newTrans)
btScalar m_additionalDampingFactor
int m_updateRevision
internal update revision number. It will be increased when the object changes. This allows some subsy...
btScalar m_additionalAngularDampingFactor
The btBroadphaseProxy is the main class that can be used with the Bullet broadphases.
btRigidBodyConstructionInfo(btScalar mass, btMotionState *motionState, btCollisionShape *collisionShape, const btVector3 &localInertia=btVector3(0, 0, 0))
btTransform m_startWorldTransform
btVector3 m_linearVelocity
btVector3 can be used to represent 3D points and vectors.
#define ATTRIBUTE_ALIGNED16(a)
btVector3DoubleData m_angularVelocity
void setAngularFactor(btScalar angFac)
void applyForce(const btVector3 &force, const btVector3 &rel_pos)
int size() const
return the number of elements in the array
btVector3FloatData m_totalTorque
btMatrix3x3FloatData m_invInertiaTensorWorld
btVector3 getVelocityInLocalPoint(const btVector3 &rel_pos) const
btScalar m_angularDamping
void setCenterOfMassTransform(const btTransform &xform)
btTypedConstraint * getConstraintRef(int index)
void setMassProps(btScalar mass, const btVector3 &inertia)
double m_additionalAngularDampingThresholdSqr
void applyDamping(btScalar timeStep)
applyDamping damps the velocity, using the given m_linearDamping and m_angularDamping ...
const btVector3 & getCenterOfMassPosition() const
btCollisionObjectDoubleData m_collisionObjectData
#define WANTS_DEACTIVATION
double m_linearSleepingThreshold
TypedConstraint is the baseclass for Bullet constraints and vehicles.
The btMotionState interface class allows the dynamics world to synchronize and interpolate the update...
void saveKinematicState(btScalar step)
int getInternalType() const
reserved for Bullet internal usage
void setAngularVelocity(const btVector3 &ang_vel)
void setInvInertiaDiagLocal(const btVector3 &diagInvInertia)
btVector3DoubleData m_gravity_acceleration
void setMotionState(btMotionState *motionState)
btVector3FloatData m_linearVelocity
btScalar m_linearSleepingThreshold
btScalar m_additionalAngularDampingThresholdSqr
#define DISABLE_DEACTIVATION
void applyCentralImpulse(const btVector3 &impulse)
const btVector3 & getGravity() const
btScalar m_additionalAngularDampingThresholdSqr
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
btMotionState * getMotionState()
const btVector3 & getTotalForce() const
btVector3 m_gravity_acceleration
btScalar m_additionalAngularDampingFactor
void applyImpulse(const btVector3 &impulse, const btVector3 &rel_pos)
const btMatrix3x3 & getInvInertiaTensorWorld() const
btBroadphaseProxy * m_broadphaseHandle
The btQuaternion implements quaternion to perform linear algebra rotations in combination with btMatr...
void setNewBroadphaseProxy(btBroadphaseProxy *broadphaseProxy)
btVector3FloatData m_invInertiaLocal
btVector3DoubleData m_totalTorque
float m_angularSleepingThreshold
btCollisionShape * m_collisionShape
btAlignedObjectArray< btTypedConstraint * > m_constraintRefs
double m_angularSleepingThreshold
void removeConstraintRef(btTypedConstraint *c)
btVector3 m_deltaAngularVelocity
double m_additionalLinearDampingThresholdSqr
void setAngularFactor(const btVector3 &angFac)
static btRigidBody * upcast(btCollisionObject *colObj)
btVector3FloatData m_gravity_acceleration
btMotionState * m_motionState
When a motionState is provided, the rigid body will initialize its world transform from the motion st...
void setActivationState(int newState) const
btScalar m_friction
best simulation results when friction is non-zero
btVector3 computeGyroscopicImpulseImplicit_Body(btScalar step) const
perform implicit force computation in body space (inertial frame)
virtual const char * serialize(void *dataBuffer, class btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
virtual void serializeSingleObject(class btSerializer *serializer) const
btVector3 getLocalInertia() const
virtual void getWorldTransform(btTransform &worldTrans) const =0
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
btScalar getAngularDamping() const
btVector3FloatData m_linearFactor
btMatrix3x3 m_invInertiaTensorWorld
void setGravity(const btVector3 &acceleration)
int getNumConstraintRefs() const