I'm working on a game where the input is done via a joystick. Normally, one would snap the players rotation to the angle that the joystick is pointing, but for my game's purpose, I have to lerp to the value to give a smooth animation. My joypad angles are calculated as follows:
- 0 - left
- 90 - front
- 180 - right
- 270 - back
An example of my problem would be: I'm pointing joystick 'front-left'(45 degrees), then I move it 'back-left'(315 degrees), instead of doing the hoped for simple anticlockwise rotation, it rotates clockwise to the value.
I understand why it happens, but I just don't have an idea how to solve this problem. I'd greatly appreciate any input, doesn't have to be code.