Browse Source

Clear forces after each physics substep so that rendering framerate doesn't affect code which calls ApplyForce() / ApplyTorque().

Lasse Öörni 12 years ago
parent
commit
ee668a791f

+ 3 - 2
ThirdParty/Bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp

@@ -13,6 +13,7 @@ subject to the following restrictions:
 3. This notice may not be removed or altered from any source distribution.
 3. This notice may not be removed or altered from any source distribution.
 */
 */
 
 
+// Modified by Lasse Oorni for Urho3D
 
 
 #include "btDiscreteDynamicsWorld.h"
 #include "btDiscreteDynamicsWorld.h"
 
 
@@ -445,6 +446,8 @@ int	btDiscreteDynamicsWorld::stepSimulation( btScalar timeStep,int maxSubSteps,
 		{
 		{
 			internalSingleStepSimulation(fixedTimeStep);
 			internalSingleStepSimulation(fixedTimeStep);
 			synchronizeMotionStates();
 			synchronizeMotionStates();
+            // Urho3D: clear forces after each substep
+            clearForces();
 		}
 		}
 
 
 	} else
 	} else
@@ -452,8 +455,6 @@ int	btDiscreteDynamicsWorld::stepSimulation( btScalar timeStep,int maxSubSteps,
 		synchronizeMotionStates();
 		synchronizeMotionStates();
 	}
 	}
 
 
-	clearForces();
-
 #ifndef BT_NO_PROFILE
 #ifndef BT_NO_PROFILE
 	CProfileManager::Increment_Frame_Counter();
 	CProfileManager::Increment_Frame_Counter();
 #endif //BT_NO_PROFILE
 #endif //BT_NO_PROFILE