Friday, September 23, 2022
HomeGame Developmentunity - Why course of physics earlier than the variable framerate replace...

unity – Why course of physics earlier than the variable framerate replace in a sport loop?


Executing the sport logic after the physics and earlier than rendering the body permits the sport logic to react to physics occasions earlier than they’re being rendered.

For instance, when the physics engine moved an object into an space the place it’s imagined to be destroyed, then the sport logic has the chance to destroy that object earlier than it will get rendered in that invalid location.

Further, Unity is ready to run the physics simulation with a a lot decrease replace charge than the FPS. In that case it presents the choices to both interpolate or extrapolate rigidbody positions (which is a setting on the Rigidbody element) to easy out the rendering of their motions. This smoothing occurs earlier than Update. So the Update technique can entry the interpolated/extrapolated object positions earlier than the rendering occurs. This is especially essential if you wish to synchronize non-rigidbody objects with rigidbodies (e.g. remodel.place = followedObject.remodel.place). This must occur earlier than rendering and with interpolated/extrapolated positions, or the objects will not be correctly synchronized.

So by working the Unity Update-method simply earlier than the rendering ensures that every one the remodel.places and remodel.rotations you verify throughout it would really be these which is able to seem on the display…

…nearly. There continues to be the animation system which runs earlier than the rendering. The cause why the animation system will get processed after Update however earlier than rendering is since you usually wish to set animation parameters in Update which you then wish to be mirrored within the present body and never the subsequent one.

But if you wish to do one thing with the objects after the animation system was resolved, Unity nonetheless has you coated. You can use LateUpdate for that function.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments