Rotation not displayed correctly

Godot Version



In the script, I set rotation to 90. However, when I run the scene, the sprite does not point downwards as it should but to the bottom right. Why is that?

1 Like

You do not rotate by 90 degrees, but set the variable to 90 (these are two different things), also you did not specify the rotation axis (if I’m not mistaken in the 2d world there are 2 axes). To rotate the object use the rotate_x (rotate_y) method, depending on which axis you want to rotate. you should also realize that the rotation will happen instantly and with each tick, so you will get a fan)

1 Like

Rotation works in radians
You either do something like:

rotation = deg_to_rad(90) #this will turn 90 degrees into radians


rotation_degrees = 90

I don’t know if Godot will end up optimizing it, but generally is recommended to always use radians so you don’t waste performance in conversions.
Something like:

rotation = 1.5708 #this is 90 degrees converted to radians.

1 Like

I did not want to rotate, just to set the rotation once. If i do it in ready function, the behaviour is even more weird: it is spinning like a fan as you mentioned and the settles with a rotation of 0 what I also don’t understand

Your suggestions have the same result

As you can see in the inscpector, the rotation is showing 82.5° instead of 90°

I deleted the scene node and tried the same constellation with a new scene with Node as root and now it works as supposed. Very strange.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.