diff --git a/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp b/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp index 405a9aeb8..4366284ea 100644 --- a/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp +++ b/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp @@ -138,6 +138,7 @@ void initSolverBody(btSolverBody* solverBody, btRigidBody* rigidbody) solverBody->m_invMass = rigidbody->getInvMass(); solverBody->m_linearVelocity = rigidbody->getLinearVelocity(); solverBody->m_originalBody = rigidbody; + solverBody->m_angularFactor = rigidbody->getAngularFactor(); } btScalar penetrationResolveFactor = btScalar(0.9); diff --git a/src/BulletDynamics/ConstraintSolver/btSolverBody.h b/src/BulletDynamics/ConstraintSolver/btSolverBody.h index 955acc104..2dda865c8 100644 --- a/src/BulletDynamics/ConstraintSolver/btSolverBody.h +++ b/src/BulletDynamics/ConstraintSolver/btSolverBody.h @@ -31,7 +31,7 @@ ATTRIBUTE_ALIGNED16 (struct) btSolverBody btRigidBody* m_originalBody; float m_invMass; float m_friction; - float m_unused; + float m_angularFactor; inline void getVelocityInLocalPoint(const btVector3& rel_pos, btVector3& velocity ) const { @@ -40,9 +40,9 @@ ATTRIBUTE_ALIGNED16 (struct) btSolverBody //Optimization for the iterative solver: avoid calculating constant terms involving inertia, normal, relative position inline void internalApplyImpulse(const btVector3& linearComponent, const btVector3& angularComponent,btScalar impulseMagnitude) - { + { m_linearVelocity += linearComponent*impulseMagnitude; - m_angularVelocity += angularComponent*impulseMagnitude; + m_angularVelocity += angularComponent*impulseMagnitude*m_angularFactor; } void writebackVelocity() @@ -65,16 +65,7 @@ ATTRIBUTE_ALIGNED16 (struct) btSolverBody - inline void applyImpulse(const btVector3& impulse,const btVector3& rel_pos) - { - if (m_invMass) - { - m_linearVelocity += impulse * m_invMass; - btVector3 torqueImpulse = rel_pos.cross(impulse); -// m_angularVelocity += m_invInertiaWorld * torqueImpulse; - } - } }; -#endif //BT_SOLVER_BODY_H \ No newline at end of file +#endif //BT_SOLVER_BODY_H diff --git a/src/LinearMath/btQuadWord.h b/src/LinearMath/btQuadWord.h index 50cda330c..961ac484d 100644 --- a/src/LinearMath/btQuadWord.h +++ b/src/LinearMath/btQuadWord.h @@ -66,6 +66,7 @@ class btQuadWord m_x=x; m_y=y; m_z=z; + m_unusedW = 0.f; } /* void getValue(btScalar *m) const