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.
Additional, Unity is ready to run the physics simulation with a a lot decrease replace price than the FPS. In that case it gives the choices to both interpolate or extrapolate rigidbody positions (which is a setting on the Rigidbody part) to clean out the rendering of their motions. This smoothing occurs earlier than Replace. So the Replace technique can entry the interpolated/extrapolated object positions earlier than the rendering occurs. That is notably necessary if you wish to synchronize non-rigidbody objects with rigidbodies (e.g. rework.place = followedObject.rework.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 Replace-method simply earlier than the rendering ensures that each one the rework.place
s and rework.rotation
s you examine throughout it should truly be these which is able to seem on the display…
…nearly. There may be nonetheless the animation system which runs earlier than the rendering. The explanation why the animation system will get processed after Replace however earlier than rendering is since you usually wish to set animation parameters in Replace which you then wish to be mirrored within the present body and never the subsequent one.
However if you wish to do one thing with the objects after the animation system was resolved, Unity nonetheless has you lined. You should use LateUpdate
for that objective.