Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Transform center;
- public Transform menuPart;
- if(menuActive)
- {
- Vector2 distance = center.position - Input.mousePosition;
- float tempAngle = Mathf.Atan2(distance.y, distance.x) * Mathf.Rad2Deg;
- tempAngle += 180f;
- for (int i = 0; i < 360; i +=45)
- {
- if(tempAngle >= i && tempAngle < i +45)
- {
- menuPart.eulerAngles = new Vector3(0,0,i);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement