I am trying to do a rotation of a game object by setting a start and end point and X frames to do the movement. Then interpolate start and end angle to get it done.
It works well, but I am trying to do the shortest possible route as an option (as opposed to "do the longest route"). In most cases it works, but if the rotation goes above 360 or below 0, I don't know how to detect it and alter the numbers. (for example if I want to take the shortest route from 270 to 90, the shortest route goes above 360/0, so is never used, so 270 should become -45 to interpolate to 90). I am terrible at explaining and I am not native English to round it up, so I will use pseudocode of what I have.
thing.start_angle = 180
thing.end_angle = 90
thing.angle = interpolate(thing.start_angle, thing.end_angle, position)
I like this way (for the detailed time control over a "if angle > max_angle then angle - 1"), but I can't find a "rule" for how to detect if the angle will rotate... How can I find if the rotation will go below 0 or above 360, to act accordingly?