Advertisement
Eonirr

Untitled

Mar 21st, 2024
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. public Transform center;
  2. public Transform menuPart;
  3.  
  4. if(menuActive)
  5. {
  6. Vector2 distance = center.position - Input.mousePosition;
  7. float tempAngle = Mathf.Atan2(distance.y, distance.x) * Mathf.Rad2Deg;
  8. tempAngle += 180f;
  9.  
  10. for (int i = 0; i < 360; i +=45)
  11. {
  12. if(tempAngle >= i && tempAngle < i +45)
  13. {
  14. menuPart.eulerAngles = new Vector3(0,0,i);
  15. }
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement