Hi guys,

this is my solution to the Unity5 rotation issue(this code is the IsStanding function):

Let’s assume that I have a threshold of 10. In that case I need to check that my object rotation is between 350 and 10 (both degrees). How can we do it?

Simple: if the number is greater than the minumum rotation (in degrees … so 350), we have to subtract that minimum rotation.

e.g. #1

the threshold is 10 and the rotation is 2.

Is 2 greater than 350? No, so no subtraction.

Is 2 lower than 10? Yes, so the pin is standing.

e.g. #2

the threshold is 10 and the rotation is 358.

Is 358 greater than 350? Yes, let’s do the subtraction…358 becomes 8.

Is 8 lower than 10? Yes, so the pin is standing.

e.g. #3

the threshold is 10 and the rotation is 13.

Is 13 greater than 350? No, so no subtraction.

Is 13 lower than 10? No, so the pin is NOT standing.

e.g. #4

the threshold is 10 and the rotation is 340.

Is 340 greater than 350? No, so no subtraction.

Is 340 lower than 10? No, so the pin is NOT standing.

Hope you will like it!