Rotate a CharacterBody2D between exact angles

Godot Version



I’m making a isometric racing game. I have the sprites doing a 360º around the car for rotation, one sprite every 11.25º (total of 32 sprites).

I have a functional car but when i turn left or right, the rotation doesn’t exactly match the direction of the sprite and it goes in a slighly different direction of where the sprite is pointing.

I’ve tried to make it have fixed rotations and cycle between them to match the sprites but i don’t know how.


I got an answer at Reddit so i post the solution here if someone has the same doubt.

instead of using rotation , i had to use rotation_degrees to set the rotation of the character in degrees at input.

rotation_degrees +=11.25

and it works fine now

Yeah, this is because Godot uses radians and not degrees.