I wanted to create my own version of the Rigidbody.MovePosition function by doing this:
void MovePos(Vector3 pos)
{
Vector3 dir = Vector3.RotateTowards(transform.forward,
pos, 360, 100);
Rb.velocity = dir;
}
But it doesn’t work as expected.
I went to a discussion where someone said that Rigidbody.MovePosition “Moves the rigidbody to the specified position by calculating the appropriate linear velocity required to move the rigidbody to that position during the next physics update. During the move, neither gravity or linear drag will affect the body. This causes the object to rapidly move from the existing position, through the world, to the specified position.”
What would this calculation be in Unity?