Code: Select all
void PHYSICS::Sync(void)
{
const float dt = DeltaTime();
LockWrite();
_pPhysWorld->stepSimulation(dt);
UnlockWrite();
}
Code: Select all
void PHYSICS::Sync(void)
{
const float dt = DeltaTime();
LockWrite();
_pPhysWorld->stepSimulation(dt);
UnlockWrite();
}
No, the speed of the simulation is decoupled of the timestep.Jack wrote:It looks like speed of the game depends on "dt". But it must not. If FPS are going up, the speed of the flying sphere (with constant velocity) is going up too.....Code: Select all
void PHYSICS::Sync(void) { const float dt = DeltaTime(); LockWrite(); _pPhysWorld->stepSimulation(dt); UnlockWrite(); }
btDynamicsWorld::stepSimulation has optional arguments for the maximum number of substeps and the fixed timestep:Jack wrote: I found it. It was due to clamping:
At low FPS numSimulationSubSteps was clamped to default 1.Code: Select all
//clamp the number of substeps, to prevent simulation grinding spiralling down to a halt int clampedSimulationSteps = (numSimulationSubSteps > maxSubSteps)? maxSubSteps : numSimulationSubSteps;
Code: Select all
stepSimulation(float deltaTime, int maxNumSubSteps=1, float fixedTimeStep=1.f/60.f);