diff options
Diffstat (limited to 'extern/bullet2/src/BulletDynamics')
-rw-r--r-- | extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.cpp | 1 | ||||
-rw-r--r-- | extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.h | 19 |
2 files changed, 18 insertions, 2 deletions
diff --git a/extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.cpp b/extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.cpp index db05f37d8c8..453b8ec4289 100644 --- a/extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.cpp +++ b/extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.cpp @@ -35,6 +35,7 @@ btRigidBody::btRigidBody(float mass, btMotionState* motionState, btCollisionShap m_totalTorque(0.0f, 0.0f, 0.0f), m_linearVelocity(0.0f, 0.0f, 0.0f), m_angularVelocity(0.f,0.f,0.f), + m_angularFactor(1.f), m_linearDamping(0.f), m_angularDamping(0.5f), m_optionalMotionState(motionState), diff --git a/extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.h b/extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.h index c5fecdb87a6..49b8525149d 100644 --- a/extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.h +++ b/extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.h @@ -47,6 +47,7 @@ class btRigidBody : public btCollisionObject btVector3 m_linearVelocity; btVector3 m_angularVelocity; btScalar m_inverseMass; + btScalar m_angularFactor; btVector3 m_gravity; btVector3 m_invInertiaLocal; @@ -159,7 +160,10 @@ public: if (m_inverseMass != 0.f) { applyCentralImpulse(impulse); - applyTorqueImpulse(rel_pos.cross(impulse)); + if (m_angularFactor) + { + applyTorqueImpulse(rel_pos.cross(impulse)*m_angularFactor); + } } } @@ -169,7 +173,10 @@ public: if (m_inverseMass != 0.f) { m_linearVelocity += linearComponent*impulseMagnitude; - m_angularVelocity += angularComponent*impulseMagnitude; + if (m_angularFactor) + { + m_angularVelocity += angularComponent*impulseMagnitude*m_angularFactor; + } } } @@ -321,6 +328,14 @@ public: int m_contactSolverType; int m_frictionSolverType; + void setAngularFactor(float angFac) + { + m_angularFactor = angFac; + } + float getAngularFactor() const + { + return m_angularFactor; + } int m_debugBodyId; |