So I have this turret and want to hard code everything and not rely on the physics engine, and I want the turret to rotate with a constant angular velocity.
I already tried this formula:
time = (angle b - angle a) / angular velocity
This does not really work because it only works if b is greater than a. I could use the min and max functions, but it still does not work because the numbers are sometimes in the negative. Still, I can just use the absolute function, but the result that it gives me is not accurate.
It seems that by adding 180 to the difference between the end angle and the start angle, taking the remainder of that value when divided by 360, and then subtracting 180, makes sure that the angle is always between negative and positive 180 degrees.