Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.37 KB | None | 0 0
  1.         Vector3 moveDirection = GetComponent<AIPath>().steeringTarget - transform.position;
  2.         if (moveDirection != Vector3.zero)
  3.         {
  4.             float angle = Mathf.Atan2(moveDirection.y, moveDirection.x) * Mathf.Rad2Deg;
  5.             if (angle < 0)
  6.                 angle = 360 + angle;
  7.             GetComponent<Animator>().SetFloat("Rotation", angle);
  8.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement