I've been trying to find a way of finding the shortest distance between two angles. The angles are in the interval -360 < 360 and are given in degrees.
In short, i need a simple way (the simpler the better) to find the shortest distance between two angles, let's call them angle1 and angle2. Angle1 is the angle i want to get to, angle 2 is the angle i am at. After this i want to use an if function to determine the rotation direction of an entity.
Pseudocode:
CloseDistance = (Find shortest distance between angle1 (where i want to go) and angle2 (where i am))
if (CloseDistance > Something)
{Rotate to the right} else {Rotate to the left}