I’m trying to move towards a point and I’m currently calling two functions during every update.
void moveForward()
{
transform.Translate(transform.forward*speed*velocity);
}
void turnTowards()
{
Vector3 desired = point -transform.position;
Vector3 rotation = Vector3.RotateTowards(transform.forward,desired,turnSpeed*Time.deltaTime,1);
transform.rotation = Quaternion.LookRotation(rotation);
}
The object rotates as I want but doesn’t move correctly, using only the rotate function points the object at the target. It is as if the transform.forward vector is wrong. The objects gets to the target point but the it looks wrong. I call rotate before movement.
I would expect the object to rotate a bit, move a bit forward in the new direction, rotate, move, rotate, move, etc…
It looks like of move and forward uses two different forward vectors which slowly syncs, only way I can describe the way it looks.