-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
set_rot() is in degree in editor but in radian in script #4511
Comments
+1. This inconsistency has annoyed me quite a bit. Everything should be the same, presumably in degrees. |
I guess this is the offending piece of code: void Node2D::set_rot(float p_angle) {
if (_xform_dirty)
((Node2D*)this)->_update_xform_values();
angle=p_angle; //this line
_update_transform();
_change_notify("transform/rot");
} Found here If needed I can fix it pretty easily i think but I want to ask the devs first to ensure that I am in the right place. EDIT: i gess that this should also be updated: float Node2D::get_rot() const {
if (_xform_dirty)
((Node2D*)this)->_update_xform_values();
return angle;
} |
The issue is not here, The problem is here: Line 403 in a895e2e
The transform/rot parameter uses the _set_rotd method, so expects degrees. But when switching to GDScript, people use set_rot which expects radians.
Not sure how to fix that without breaking all existing Godot games :) |
I guess I read the issue all wrong. Sorry.
exactly what I was thinking. |
This behavior is intended, Godot works with radians internally, but will On Wed, May 4, 2016 at 9:41 AM, Mattias Cibien notifications@github.com
|
As I mentioned on Facebook:
Will implement that. |
@akien-mga thank you. Sorry for the inconvenience. |
No problem, I do agree that this apparent inconsistency is confusing, even if it has a good justification as @reduz mentioned. |
Made public the various set/getters for rotations in degrees. For consistency, renamed the exposed method names to remove the leading underscore, and kept the old names with a deprecation warning. Fixes godotengine#4511.
Thank you ! |
Operating system or device:
Windows 10 Pro
Issue description (what happened, and what was expected):
When setting rot from script you must use deg2rad, but in editor it's in degree. It was supposed to be either everything in radians or in degrees. At the very least something in the docs saying that it was in radian.
Steps to reproduce:
Attach a new script to a sprite and write set_rot(80). It's going to be completely erroneous. Now put set_rot(deg2rad(80)). It works just fine.
The text was updated successfully, but these errors were encountered: