So I noticed that
Rigidbody.MovePosition( Rigidbody.position + some Vector3 )
Transform.position += some Vector3
produces different results. I can’t find any documentation on how the two is differently implemented (with regards to setting the transform.position). Any ideas?
The scripting manual does mention this a bit:
Changing the position of a Rigidbody object by setting its transform.position value will cause it to “teleport” directly to the new position (ie, it doesn’t move through any intermediate positions along the way). Any other Rigidbodies lying between the old position and the new one will be unaffected by the movement. Also, any colliders at the target position will react immediately with the moved rigidbody on the next update.
If you use MovePosition instead, the physics engine will trace a straight line path between the object’s old position and the new one and behave as though it rapidly moved along that path between updates. Objects lying along the path will be pushed aside if necessary. This often gives a more acceptable result than changing transform.position. However, if the movements are small and frequent then the two techniques behave very similarly.
A Rigidbody does not have a Translate() function, so I assume you are trying to compare
transform.position += some Vector3
The reason they are different is because, by default, Transform.Translate() uses local coordinates, where directly incrementing the position uses world coordinates. You can make Translate() use world coordinates:
transform.translate(some Vector3, Space.World);
You can also increment a position using local coordinates:
transform.position += transform.TransformDirection(some Vector3);
And if you really asking about a Rigidbody, pay attention to @rutter’s answer.