I saw some people struggling with 2D movement in unity so i made a tutorial explaining the best way to do it
Cheers.
I saw some people struggling with 2D movement in unity so i made a tutorial explaining the best way to do it
Cheers.
You defeat the purpose of using physics by moving with the transform directly in fixed update. This is not good to teach new people.
Yes, you should never modify the Transform when using physics objects. A Rigidbody2D is responsible for that because you added it and expect it to “move” by modifying the Transform but you then also modify it yourself. This is a conflict.
If you want it to move then use the Rigidbody2D API. The allows you to add forces, set velocity direction, use MovePosition/MoveRotation or worse cast, immediately set the body position/rotation.
One major problem you’ll have by modifying the Transform is that you bypass Rigidbody interpolation so you cannot get smooth motion in your demo.