I'd like to discuss btDiscreteDynamicsWorld::stepSimulation.
I thought I had this resolved long ago, but timing issues have reared their ugly head once again. In particular, my server and client simulations are running at very different rates.
I noticed my frame rate on the client was down so I turned on my profiler. This showed that all the lost time was being spend calling:
Code: Select all
m_dynamicsWorld->stepSimulation( timeDeltaMs * 0.001f, 10 ); // expects timeDelta in seconds
I thought maybe my timer is bad (even tho it worked before) so I switched to btClock specifically timing the time delta between calls to stepSimulation, and upped the update rate to 60Hz. It better but movement is still not right on client.
The client is a Win7 build running directX, with a parallel sim taking place on a Ubuntu Linux server. I can turn on rendering of the incoming server updates and it is clear the client is dragging behind the correct speed shown on server (server profiler: 1ms for same call to stepSim!). The client is constantly snapping to the position of the server because the sims are so different. Its not a network issue. This used to work!
How should I be correctly using stepSim. In particular I am puzzled why the maxSubSteps parameter affect speed when the loop is already fast.
Thanks for any advice.
Simon