A little thing I want to do at the beginning of a level is to advanced the physics simulation by 5-10 seconds to allow any objects to “settle”. I have tried the following methods to do so:
_scene->SetTimeScale(2.5f);
_scene->Update(10.f);
_scene->SetTimeScale(1.f);
However no matter how I update it, it always locks up the simulation for the full duration. So doing physics->GetWorld()->stepSimulation(10.f, 1024);
will still cause a 10-second delay to the user.
Update: I’ve gotten it to work with the following snippet:
[code]physics->GetWorld()->setInternalTickCallback(0, 0, true);
physics->GetWorld()->setInternalTickCallback(0, 0, false);
physics->GetWorld()->stepSimulation(10.f, 1024);
physics->GetWorld()->setInternalTickCallback(Urho3D::InternalPreTickCallback, static_cast<void*>(physics), true);
physics->GetWorld()->setInternalTickCallback(Urho3D::InternalTickCallback, static_cast<void*>(physics), false);[/code]
However this seems like a really dirty way to advanced the time.