In my project I was using Rigidbody2D.MovePosition() to move certain stuff around. These GameObjects has fixed angle and isKinematic checked.
So I’ve recently updated to Unity 5.0.2f1 and when I use MovePosition now these GameObjects moves to the specified position during the next physics update but it’s velocity which was used internally by the system to move it doesn’t get reset, causing it to move again at the same vector in the next update.
Is this intentional?
Sample code:
bool doItOnce = true;
void FixedUpdate(){
if(doItOnce){
doItOnce = false;
this.gameObject.GetComponent<RigidBody2D>().MovePosition(this.transform.position + Vector2.up*10f);
}
}
fixedAngle and isKinematic checked.
So in the above code the gameobject would move 10 units up in the next FixedUpdate and another 10
units in the following FixedUpdate and so forth.
What I expected, and previously happened before the update, was for the gameobject to move to the set position and stop there.