3 ms·
A good example is moving the camera: lets say you have a camera set to follow a particular character (in some fancy way), but you only update it in FixedUpdate(
by OskarS 6y ago
A good example is moving the camera: lets say you have a camera set to follow a particular character (in some fancy way), but you only update it in FixedUpdate(). If your framerate is faster than the physics update, FixedUpdate() will not be called every frame, and your camera will get a visible stutter (it will essentially be "temporally aliased" with the physics updates). Therefore, camera movement updates should always go in Update(). This kind of reasoning applies for many "game logic" things.
There's a flip-side to that though: if the stuff in the world are physics objects (especially if it's your main character), and they only update in FixedUpdate(), then even if the camera moves smoothly, the objects will stutter. Hence, you need to do some kind of interpolation or something of them as well in FixedUpdate().
The point is: this stuff is really, really hard to get right. There is no simple right answer.
- badsectoracula 6y agoOn the other hand if you update the camera per frame you'll end up with the shotgun bug in Deus Ex: The Fall when running with vsync turned off (see Total Biscuit's video on the game as an example for all sorts of bugs that exist because of timing issues from updating stuff per frame - note that TB didn't realize that). If you want to follow a character in a fancy way (ie. not locked), update the camera's target position in fixed steps and perform smooth interpolation between the last position and the current position for the frames between the updates.