CSharp examples for System:Math Geometry
Clamp Angle
using UnityEngine; public class Main{ public static float ClampAngle(float angle, float min, float max) {//ww w. j a v a2s .c om do { if (angle < -360) angle += 360; if (angle > 360) angle -= 360; } while (angle < -360 || angle > 360); return Mathf.Clamp(angle, min, max); } }