Forum begins after the advertisement:
-
::Hi,
I added Rigidbody2Ds to my enemies to that they’d collide with each other, instead of overlapping, but they started moving incredibly slow.
I realised that the Move() function executes Rigidbody2D movement on an Update, not a FixedUpdate. After I changed it so that the Rigidbody2D movement code was executed through a FixedUpdate, it fixed the issue.
Kind Regards,
Sean
::Thanks for sharing this Sean. Much appreciated.
::Also, regarding the knockback in the Update function, should this be handled by the rigidbody too if one is present?
::Yes. Theoretically speaking, putting it on FixedUpdate()
should give you more consistent behaviour, so you should always do that when it is possible.
I haven’t run into any issues doing it on Update()
, but Unity advises that all changes to Rigidbodies should be made on FixedUpdate()
as a best practice.
::If u have anymore doubts u can ask here I will be glad to help
Advertisement below: