From 6cbf89905f60db80bfef21954acceada3a6b6b7b Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Mon, 25 Aug 2014 08:48:45 -0700 Subject: [PATCH] move the clearForceAndTorque to after the stepVelocities, see also https://github.com/bulletphysics/bullet3/pull/221 todo: create test --- .../Featherstone/btMultiBodyDynamicsWorld.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.cpp b/src/BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.cpp index 6452067ea..af280d24a 100644 --- a/src/BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.cpp +++ b/src/BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.cpp @@ -455,7 +455,6 @@ void btMultiBodyDynamicsWorld::solveConstraints(btContactSolverInfo& solverInfo) scratch_v.resize(bod->getNumLinks()+1); scratch_m.resize(bod->getNumLinks()+1); - bod->clearForcesAndTorques(); bod->addBaseForce(m_gravity * bod->getBaseMass()); for (int j = 0; j < bod->getNumLinks(); ++j) @@ -468,7 +467,9 @@ void btMultiBodyDynamicsWorld::solveConstraints(btContactSolverInfo& solverInfo) if(bod->isMultiDof()) { if(!bod->isUsingRK4Integration()) + { bod->stepVelocitiesMultiDof(solverInfo.m_timeStep, scratch_r, scratch_v, scratch_m); + } else { // @@ -625,9 +626,12 @@ void btMultiBodyDynamicsWorld::solveConstraints(btContactSolverInfo& solverInfo) } } - else + else//if(bod->isMultiDof()) + { bod->stepVelocities(solverInfo.m_timeStep, scratch_r, scratch_v, scratch_m); - } + } + bod->clearForcesAndTorques(); + }//if (!isSleeping) } }