void step(b2World& world, float dt) { const int maxSteps = 20; const float fixedDt = 1.0f / 60.f; const float minDt = fixedDt / 10.f; int stepsPerformed = 0; float frameTime = dt; while (frameTime > 0.0f && stepsPerformed < maxSteps) { float delta = (std::min)(frameTime, fixedDt); frameTime -= delta; if (frameTime < minDt) { delta += frameTime; frameTime = 0.0f; } const int velocityIterations = 8; const int positionIterations = 3; world.Step(delta, velocityIterations, positionIterations); } world.ClearForces(); }
void Ex59AdvancedJointsApp::update() { arm->update( mouse ); world->Step( timeStep, velocityIterations, positionIterations ); world->ClearForces(); }