Rigidbody2D.velocity Vs Rigidbody2D.MovePosition()

Just curious about the difference between these two methods of moving an object and if there is benefits or negatives to either one.

1 Like

Velocity is a property that, according to Unity’s API, you should not modify directly because it might cause unexpected behavior (I’ve never seen anything like that), but you can use it to smoothly simulate any type of acceleration or explosion impacts.

MovePosition is a method that simply moves the object, it doesn’t teleports it, but moves it, you can fake acceleration but it’s not recommended since you’ll have to code more than if you use the velocity property instead.

At the end it truly depends on the project, for instance, if you are trying to do a grid move system similar to older JRPGs you should use MovePosition instead of velocity. If you are making a racing game modify the velocity with the different methods.

Hope this helps, here are some documents, try to experiment with both a little bit and see the benefits and drawbacks for yourself.


This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms