- Home /
AddForce vs MovePosition Rigidbody.
What is the difference between these two? Why should I choose one and not the other? As I tested the differences between these two, I discovered that with both I can manipulated the position of a rigidbody, although with MovePosition, some weird physics is happening on collision. But I wanted to try out MovePosition because it just sounds less physics simulation and thus better performance.
Someone can clear my doubts?
Answer by Wuzseen · Mar 04, 2013 at 07:38 AM
From what I understand, MovePosition is really meant for kinematic rigidbodies. For all other rigidbody movement, it should be done with AddForce.
MovePosition translates your rigidbody and calculates physics as it moves along the way. AddForce applies the brute "force" to an object.
yes your're right. In fact when trying $$anonymous$$ovePosition on my non-kinematic rigidbody (platform), when the platform hits the ball, no physics is applied. I have to turn back to addForce ^^.
Thanks for the tip :)
Answer by Owen-Reynolds · Mar 04, 2013 at 02:48 PM
RE: "translate" from the answer above: MovePosition will put your object at the target location, no matter what. It may push aside other objects in a realistic way, or may blast them out of the way, or may just pass right through them. But it will gladly move you through a solid wall or a mountain.
If you're using MovePosition on a rigidbody to add from where you currently are, it looks like AddForce. With AddForce, the physics step does all the work: applies your velocity, sees the collision and handles the bounce. With MovePosition, the physics step sees you're mysteriously overlapping a solid object. If it isn't too much, it will bounce you apart.