xexuxjy wrote:applyGravity doesn't have any timestep component to it, all it does is update the total force so it has a standard 9.8m/s value , it's only when integrateTransforms is called during the rest of the simulation that the timestep comes into play . I believe thats why it's setup outside the number of steps sub loop.
I guess one option you could do is just have bullet have a gravity value of zero, and apply a gravity value in your scripts along with your other forces so they're guaranteed to be in step?
That one seems like too much work heh...
What I ended up doing, and seems to work so far, is to make sure myself that each "stepSimulation" calls only one substep, like this:
Code: Select all
localTime+=((float)deltaMilliseconds)/1000.f;
while( localTime > PhysicsMan::timeStepLength ){
world->stepSimulation( PhysicsMan::timeStepLength, 2, PhysicsMan::timeStepLength );
localTime-=PhysicsMan::timeStepLength;
}
where localTime is a member float variable. I pass a maxSubSteps=2 just in case.