+1 vote

I have a couple of questions about angles and the property rotation in Godot.

-Why is the property rotation of a node2D measured in radians while rect_rotation on a Control node is measured in degrees?.

I know you can transform from radians to degrees but it took me a while to check the documentation for rect_rotation to realise I was using the wrong measurement. So I was wondering if there is a reason. Do degrees work better on Control nodes and that's why it's their default?.

-My second question is about angles and this may be more of a math problem more than an engine thing.

When I add degrees to the rotation_degree property of a Node2D the rotation property goes over and under 360 and -360 is there a use for this?

Personally I don't understand why would you use negative degrees a part from the obvious clockwise rotation from subtracting degrees. But once you hit 0 you can make the rotation 360 and achieve the same result right?.

I'm achieving this by manually resetting the rotation, let me know if there's a better way of doing this:

if rotation_degrees >= 360 or rotation_degrees <= 0: 
rotation_degrees = fposmod(rotation_degrees,360.0)

So why does the engine not do that automatically is there a reason to save the rotation of an object as 1000 degrees? or -1000 degrees?

in Engine by (235 points)
edited by

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.

Categories