Okay, here's a REAL noob question for you...
Which of the above should I be using for my race car? It's a VERY basic retro -styled game and I have it working perfectly with transform.Translate/rotate but the collision seems a little odd. I read somewhere that if you want the objects to collide, you should use rigidbody.MovePosition? Is this true? And if so... why is this? Also, I want my game to be able to run on low end hardware... which of the two methods produces the least CPU overheads?
Unfortunately, the Unity scripting reference just didn't answer my questions...
asked Feb 08 '12 at 07:11 PM
The reason why it is recommended to use MovePosition is because when the rigid body is NOT kinematic, an extra step is taken into account when calculating how the rigid body reacts to physics. Since the transform has nothing to do with physics, it is just the coordinate information of the NON physics based components of the Game Object, this causes variation between the two bodies.
Now MovePosition takes this into effect and more properly handles your transform information along with your rigid body information.
When you think about it, when translating the transform and not the rigid body itself in the case of NON-kinematic bodies, the rigid body information is thus calculated at the end of the physics step frame, causing a slight difference in the two positions of each body. It's pretty much the same thing if you translate the position of the rigid body using
or anything of the like. MovePosition was made specifically to deal with this oscillation of the two bodies in conjunction with active physics. CPU overhead is negligible in this case, since MovePosition was made specifically for this purpose.
answered Feb 08 '12 at 08:10 PM