Hello
I have a script which turns and moves the character in the direction of travel like this:
animation.SetFloat("Forward",0.2f);
Vector3 direction = (target - transform.position).normalized;
Vector3 newDir = Vector3.RotateTowards(transform.forward, direction, 3.0f * Time.deltaTime, 0.0F);
transform.rotation = Quaternion.LookRotation(newDir);
transform.Translate(direction * Time.deltaTime * walkSpeed, Space.World);
But i don’t want the character to walk forwards until he is facing the desired direction, otherwise he is walking and turning at same time and it doesn’t look right.
How can i check the angle of the character’s direction against travel direction ? Also is there a simple way to know if the turning angle is left or right (this would help so i can add a turning animation in future).