Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public static class Helper
- {
- public static float ClampAngle (float angle, float min, float max)
- {
- do
- {
- // If angle is less than 360 - add 360
- if (angle < -360)
- angle += 360;
- // If angle is greater than 360 - subtract 360
- if (angle > -360)
- angle -= 360;
- } while (angle < -360 || angle > 360);
- return Mathf.Clamp (angle, min, max);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement