I’ve never really been sure what value to use for the physics timestep. I’ve done a number of 2D scrolling games, but I’m looking for the most optimal settings settings.
Let’s say I have a 2D physics game where the camera follows a rigidbody. Now, I need to manipulate the physics object in FixedUpdate. But I probably need to make the camera follow the rigidbody in Update or LateUpdate, right?
The default timestep value is 0.02, so the rigidbody moves at 50 fps. Does it then even make sense to render the game at, say 60 fps? It’s slightly faster, but if the scene’s state didn’t change, why render faster?
Or should I set my Fixed Timestep to 0.016666666666666… so it runs at the same framerate as I’m rendering?
Set the fixed timestep at the lowest fps you can get away with where the game still works. You can use interpolation/extrapolation to smooth movement between physics frames.
Thanks for the reply! Seems to be what I was looking for, I’ll give it a go.
In my previous game I set both the fixed timestep and the framerate to 50, I knew that wasn’t ideal but the results were ok.
You can’t really have a framerate of 50 on the iPhone though…it essentially uses vsync always, so you get 60fps, 30fps, 15fps, etc. The only way to get 50 is if it mostly runs at 60fps but drops to 30fps sometimes (which doesn’t make for the best experience; probably you just want to use 30 in that case).
Yeah I’ve been told that before, however setting it to 50 seemed smoother to me than either 30 and 60. That probably had something to do with the fixed timestep being 0.02 (50 fps) without any interpolation, but I’m not sure
Hmm, in one project, setting the main character’s rigidboy to Interpolate made it feel really heavy and sluggish (kept the timestep the same for now).
Extrapolation is better, but it feels different than it was, it moves at different speeds somehow.
Is this normal/expected?