I’m trying to make a rotation wheel, and basically what I want to do is to limit the wheel rotation say 90 degrees to right and 270 to left(like a steering wheel).First, I convert values from 0 - 360 if(angle<0){angle+=360} //this gives me the values 0-360, which is pretty good.

My math looks like this:
if(angle>90) {angle = 90} //this part works perfect, however if i want to steer left:
if(angle<270) {angle = 270} // here is the confusion because, say 265<270 is true, but 265>90 is also true.

If anyone could explain how to convert the values from 1 to 180(right part) and from -1 to -180(left part), then I guess the solution would be simplier.

I used Math.Clamp(angle, -100, 100), but didn’t work.

First, get the values 0-360 if(angle< 0){angle+=360} // 0-360
Second, get right rotation part values (0 to 180) and left part (0 to -180) with this:
if(angle>180){angle-=360} // 0-180 , -180-0

Now, we can set the rotation limit like this:
if(angle>120) {angle=120} //right limit
if(angle<-120) {angle=-120} //left limit