First, please put your code in code tags as explained here: https://discussions.unity.com/t/481379
And the reason you shouldn’t move your RigidBody
in Update
function is because physics has a separate world where all physics simulated. This world is updated right after the FixedUpdate
calls but not after Update
calls.
You can find under the label of “internal physics update” on this chart: https://docs.unity3d.com/Manual/ExecutionOrder.html
This means if you update your RigidBody
in Update
method, the physics won’t know about it until the next internal update, which may or may not happen in even the next frame.
Remember: physics is running on a different clock (by default 50 times a second and in a different manner), so during a render frame it is possible that the physics update doesn’t happen or happen more than once.
This makes your physics simulation unreliable.