Moved the 'btRigidBody::clearForce' to the end of the stepSimulation, instead of in each substep.
Should help with this issue, reported here: http://www.bulletphysics.com/Bullet/phpBB3/viewtopic.php?f=9&t=1601 We can optionally leave out the 'clearForces'. Thanks everyone for the discussion.
This commit is contained in:
@@ -196,6 +196,21 @@ void btDiscreteDynamicsWorld::debugDrawWorld()
|
||||
}
|
||||
}
|
||||
|
||||
void btDiscreteDynamicsWorld::clearForces()
|
||||
{
|
||||
//todo: iterate over awake simulation islands!
|
||||
for ( int i=0;i<m_collisionObjects.size();i++)
|
||||
{
|
||||
btCollisionObject* colObj = m_collisionObjects[i];
|
||||
|
||||
btRigidBody* body = btRigidBody::upcast(colObj);
|
||||
if (body)
|
||||
{
|
||||
body->clearForces();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void btDiscreteDynamicsWorld::synchronizeMotionStates()
|
||||
{
|
||||
{
|
||||
@@ -292,8 +307,10 @@ int btDiscreteDynamicsWorld::stepSimulation( btScalar timeStep,int maxSubSteps,
|
||||
|
||||
synchronizeMotionStates();
|
||||
|
||||
CProfileManager::Increment_Frame_Counter();
|
||||
clearForces();
|
||||
|
||||
CProfileManager::Increment_Frame_Counter();
|
||||
|
||||
return numSimulationSubSteps;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user