Changeset View
Changeset View
Standalone View
Standalone View
extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.h
| Show All 35 Lines | |||||
| #define btRigidBodyData btRigidBodyFloatData | #define btRigidBodyData btRigidBodyFloatData | ||||
| #define btRigidBodyDataName "btRigidBodyFloatData" | #define btRigidBodyDataName "btRigidBodyFloatData" | ||||
| #endif //BT_USE_DOUBLE_PRECISION | #endif //BT_USE_DOUBLE_PRECISION | ||||
| enum btRigidBodyFlags | enum btRigidBodyFlags | ||||
| { | { | ||||
| BT_DISABLE_WORLD_GRAVITY = 1, | BT_DISABLE_WORLD_GRAVITY = 1, | ||||
| ///The BT_ENABLE_GYROPSCOPIC_FORCE can easily introduce instability | ///BT_ENABLE_GYROPSCOPIC_FORCE flags is enabled by default in Bullet 2.83 and onwards. | ||||
| ///So generally it is best to not enable it. | ///and it BT_ENABLE_GYROPSCOPIC_FORCE becomes equivalent to BT_ENABLE_GYROSCOPIC_FORCE_IMPLICIT_BODY | ||||
| ///If really needed, run at a high frequency like 1000 Hertz: ///See Demos/GyroscopicDemo for an example use | ///See Demos/GyroscopicDemo and computeGyroscopicImpulseImplicit | ||||
| BT_ENABLE_GYROPSCOPIC_FORCE = 2 | BT_ENABLE_GYROSCOPIC_FORCE_EXPLICIT = 2, | ||||
| BT_ENABLE_GYROSCOPIC_FORCE_IMPLICIT_WORLD=4, | |||||
| BT_ENABLE_GYROSCOPIC_FORCE_IMPLICIT_BODY=8, | |||||
| BT_ENABLE_GYROPSCOPIC_FORCE = BT_ENABLE_GYROSCOPIC_FORCE_IMPLICIT_BODY, | |||||
| }; | }; | ||||
| ///The btRigidBody is the main class for rigid body objects. It is derived from btCollisionObject, so it keeps a pointer to a btCollisionShape. | ///The btRigidBody is the main class for rigid body objects. It is derived from btCollisionObject, so it keeps a pointer to a btCollisionShape. | ||||
| ///It is recommended for performance and memory use to share btCollisionShape objects whenever possible. | ///It is recommended for performance and memory use to share btCollisionShape objects whenever possible. | ||||
| ///There are 3 types of rigid bodies: | ///There are 3 types of rigid bodies: | ||||
| ///- A) Dynamic rigid bodies, with positive mass. Motion is controlled by rigid body dynamics. | ///- A) Dynamic rigid bodies, with positive mass. Motion is controlled by rigid body dynamics. | ||||
| ///- B) Fixed objects with zero mass. They are not moving (basically collision objects) | ///- B) Fixed objects with zero mass. They are not moving (basically collision objects) | ||||
| Show All 26 Lines | class btRigidBody : public btCollisionObject | ||||
| btScalar m_linearSleepingThreshold; | btScalar m_linearSleepingThreshold; | ||||
| btScalar m_angularSleepingThreshold; | btScalar m_angularSleepingThreshold; | ||||
| //m_optionalMotionState allows to automatic synchronize the world transform for active objects | //m_optionalMotionState allows to automatic synchronize the world transform for active objects | ||||
| btMotionState* m_optionalMotionState; | btMotionState* m_optionalMotionState; | ||||
| //keep track of typed constraints referencing this rigid body | //keep track of typed constraints referencing this rigid body, to disable collision between linked bodies | ||||
| btAlignedObjectArray<btTypedConstraint*> m_constraintRefs; | btAlignedObjectArray<btTypedConstraint*> m_constraintRefs; | ||||
| int m_rigidbodyFlags; | int m_rigidbodyFlags; | ||||
| int m_debugBodyId; | int m_debugBodyId; | ||||
| protected: | protected: | ||||
| ▲ Show 20 Lines • Show All 402 Lines • ▼ Show 20 Lines | public: | ||||
| } | } | ||||
| //is this rigidbody added to a btCollisionWorld/btDynamicsWorld/btBroadphase? | //is this rigidbody added to a btCollisionWorld/btDynamicsWorld/btBroadphase? | ||||
| bool isInWorld() const | bool isInWorld() const | ||||
| { | { | ||||
| return (getBroadphaseProxy() != 0); | return (getBroadphaseProxy() != 0); | ||||
| } | } | ||||
| virtual bool checkCollideWithOverride(const btCollisionObject* co) const; | |||||
| void addConstraintRef(btTypedConstraint* c); | void addConstraintRef(btTypedConstraint* c); | ||||
| void removeConstraintRef(btTypedConstraint* c); | void removeConstraintRef(btTypedConstraint* c); | ||||
| btTypedConstraint* getConstraintRef(int index) | btTypedConstraint* getConstraintRef(int index) | ||||
| { | { | ||||
| return m_constraintRefs[index]; | return m_constraintRefs[index]; | ||||
| } | } | ||||
| int getNumConstraintRefs() const | int getNumConstraintRefs() const | ||||
| { | { | ||||
| return m_constraintRefs.size(); | return m_constraintRefs.size(); | ||||
| } | } | ||||
| void setFlags(int flags) | void setFlags(int flags) | ||||
| { | { | ||||
| m_rigidbodyFlags = flags; | m_rigidbodyFlags = flags; | ||||
| } | } | ||||
| int getFlags() const | int getFlags() const | ||||
| { | { | ||||
| return m_rigidbodyFlags; | return m_rigidbodyFlags; | ||||
| } | } | ||||
| btVector3 computeGyroscopicForce(btScalar maxGyroscopicForce) const; | |||||
| ///perform implicit force computation in world space | |||||
| btVector3 computeGyroscopicImpulseImplicit_World(btScalar dt) const; | |||||
| ///perform implicit force computation in body space (inertial frame) | |||||
| btVector3 computeGyroscopicImpulseImplicit_Body(btScalar step) const; | |||||
| ///explicit version is best avoided, it gains energy | |||||
| btVector3 computeGyroscopicForceExplicit(btScalar maxGyroscopicForce) const; | |||||
| btVector3 getLocalInertia() const; | |||||
| /////////////////////////////////////////////// | /////////////////////////////////////////////// | ||||
| virtual int calculateSerializeBufferSize() const; | virtual int calculateSerializeBufferSize() const; | ||||
| ///fills the dataBuffer and returns the struct name (and 0 on failure) | ///fills the dataBuffer and returns the struct name (and 0 on failure) | ||||
| virtual const char* serialize(void* dataBuffer, class btSerializer* serializer) const; | virtual const char* serialize(void* dataBuffer, class btSerializer* serializer) const; | ||||
| ▲ Show 20 Lines • Show All 62 Lines • Show Last 20 Lines | |||||