Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Vector3 moveDirection = GetComponent<AIPath>().steeringTarget - transform.position;
- if (moveDirection != Vector3.zero)
- {
- float angle = Mathf.Atan2(moveDirection.y, moveDirection.x) * Mathf.Rad2Deg;
- if (angle < 0)
- angle = 360 + angle;
- GetComponent<Animator>().SetFloat("Rotation", angle);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement