I'm using a Object (Cannon) that rotates only in 2 axis. And I'm trying to limit the rotation that this Cannon can do.
My object start with all Rotation in 0. And I want the rotation is limited from 0 to -90 (270).
=> This object cant rotate to angles > (more than) 0, and < (less than) 270 (or -90)
I mean: (angle < 0 && angle > 270)
A little CODE:
And I found this code to limit the rotation, but when I put the mouse in a position that give a angle more than 0, the object back to the value -90. If the object stayed in the position 0 when angle were more than 0, and stayed in -90 (or 270) when the angle were less than 270 will fixed.
The function to limit:
Thks for all!