I’m new to Urho and have been working on a little project for some weeks now. I noticed I have an issue with physics behaving very differently when under a heavy load. What I’d like to happen is time slowing down while retaining consistent physics simulation. It seems like this topic is covered for PhysicsWorld in the documentation:
The physics simulation has its own fixed update rate, which by default is 60Hz. When the rendering framerate is higher than the physics update rate, physics motion is interpolated so that it always appears smooth. The update rate can be changed with SetFps() function. The physics update rate also determines the frequency of fixed timestep scene logic updates. Hard limit for physics steps per frame or adaptive timestep can be configured with SetMaxSubSteps() function. These can help to prevent a “spiral of death” due to the CPU being unable to handle the physics load. However, note that using either can lead to time slowing down (when steps are limited) or inconsistent physics behavior (when using adaptive step.)
However, I am using PhysicsWorld2D and am not able to find similar settings. I am now wondering what the correct way to do this is. Would anyone be able to offer any pointers? Is there a built-in way of doing this or will I need to implement something myself (such as what is described at Fix Your Timestep! | Gaffer On Games )?
I tried searching the forums and looking into a few of the sample programs but wasn’t able to draw much conclusions about things such as: should processing input and applying forces be done in Update or FixedUpdate? Which actions (i.e applying forces/impulses/translations) should actually consider the timestep. I have some assumptions but am a bit confused here.
I also noticed that FixedUpdate for my LogicComponents was being called at the same intervals as Update despite the documentation stating it uses fixed timesteps. This was corrected once I added a PhysicsWorld component. Should I include PhysicsWorld in my program despite the fact that I’m really using PhysicsWorld2D?