In my game, I use the vertical direction arrows to rotate my object up and down. First, I want to restrict the range from 360 to 310 degrees (as I’m seeing them in the Inspector). The idea I had was to use an if statement, but I don’t know how to reference the x rotation of my object. My code would look something like this:
if (transform.x > 310) {do the action I want;}
Second, my object jumps at the x angle, but lands with the same x angle. I want to reset ONLY the x angle to 360 to level it out on landing, but leave the y and z as they are. How can I change only the x rotation? transform.rotation = Quaternion.identity doesn’t work for me because the y rotation is also reset.
Thank you for your help.
BTW, the prototype I’m working on is for a Capture the Flag game. If anyone wants to collaborate, just reply.