Hi everyone,
In my 3D battleships game, I have a turret attached to the front and back of the ship, and need to prevent them from turning too far(see pic below).

[image][/image]
This is a problem because the ship can also turn seperate of the turret and get a rotation in the thousands of degrees because it overruns the 360 degree numerical rotation value. Because of this, I can't compare the turret's rotation to the ship's rotation and limit it's rotation properly. My script is:
Code:
  
vec_set(my.pan, your.pan);
my.pan += heading;
my.pan = max(my.pan, your.pan + 70);
my.pan = min(my.pan, your.pan + 290);



How can i change this to account for the fact that the value for the ships pan may be far greater than 360 degrees?


Murphey's Law:
<< if anything can go wrong, it will >>

(Murphey was an optimist).