I’m having issues when I rotate to the left. When rotating to the right it works, but sometimes when rotation to the left it gets kind of messed up. I must be missing something with this logic.
Vector3 rot = selectedObj.transform.rotation.eulerAngles;
float y = 0f;
if(rot.y > 55 rot.y < 65)
y = 60;
if(rot.y > 115 rot.y < 125)
y = 120;
if(rot.y > 175 rot.y < 185)
y = 180;
if(rot.y > 235 rot.y < 245)
y = 240;
if(rot.y > 295 rot.y < 305)
y = 300;
if(rot.y > 355 rot.y < 5)
y = 0;
gObj.transform.rotation = Quaternion.AngleAxis(y, Vector3.up);