How do I rotate an object from its current angle to the desired angle in increments on 1 axis? The problem is the wraparound at 360 degrees What I have so far (Note: pseudocode):
double MaxSpeed = 5;
double CurrentAngle = -170;
double DesiredAngle = 40;
double Distance = DesiredAngle - CurrentAngle; //How do I calculate this value considering angle wraparound?
CurrentAngle += Mathd.clamp(Distance, -MaxSpeed, MaxSpeed); //Caps the rotation speed