-
-
Notifications
You must be signed in to change notification settings - Fork 23k
Description
Godot version
4.0alpha12+
System information
Win 10/64 NVIDIA GeForce GTX 1060/PCIe/SSE2
Issue description
Core Issues
-
Many of us used rotation_degrees in our code and AnimationPlayers. It was removed for no good reason. Please restore it.
-
The Inspector and code use different units for the same rotation variable. (?!)
The engine devs clearly understand that game devs wish to use degrees, because they provide degrees in the inspector. In fact it's the only option. Yet in code we can only work with radians, as rotation_degrees was removed.
It's crazy to use rotation
in the inspector with degrees, while rotation
in code works in radians. Any experienced game dev is going to be working with rotations in both the inspector and code. Virtually no one is going to use only one.
Radians and degrees are currently both implemented in the engine, so there is absolutely no savings of code or memory by neutering the API. At best, there are a few less lines on the manual page.
This choice has broken our animationplayers, forced us to rewrite our code, and manually convert degrees, and leaves the engine in a weird state where we use two different units for the same variable.
Please give us back the two variable syntactic sugar of rotation(radians) and rotation_degrees. Or if you want to drop one, drop radians. Or find another solution, such as below, but using two different units for rotation is nuts.
Alternative
Rotation, like all transform options are commonly updated frequently, every frame, on potentially thousands of objects. There is a deg_to_rad(float)
function, but no Vector* variations.
This means for those of us who want to work in degrees in 3D, we must deconstruct a Vector3, convert each component, then reconstruct the Vector. This is unnecessarily slow in GDScript, every frame, on thousands of objects, when it could be done in C++ (especially since the code is already there).
As an alternative to the above:
- Please provide
deg_to_rad(Vector2/3/4)
variations (andrad_to_deg
) so we can convert in C++ rather than GDscript. - Convert AnimationPlayer animations by renaming rotation_degrees to rotation. The values are the same since the editor works in animations only. See 3.x to 4.0 converter does not convert rotation_degrees property of animations #65481.
Or maybe we do everything: restore rotation_degrees, make the code and inspector function the same way, and provide deg_to_rad(vector) and convert animation tracks. I haven't heard a single good reason for neutering the API. And I've experienced and heard of a lot of pain from devs as we fix things that unnecessarily broke.
Related to #58316, but that's an editor issue.
Steps to reproduce
# Unnecessarily slow:
node.rotation = Vector3( deg_to_rad(new_deg_rotation.x), deg_to_rad(new_deg_rotation.y), deg_to_rad(new_deg_rotation.z) )
# Should be:
node.rotation_degrees = new_deg_rotation
# or
node.rotation = deg_to_rad(new_deg_rotation)
Temporary Workaround
Fine for limited use, but not optimal for updates on many objects every frame.
# Util.gd
static func d2r(vect: Vector3) -> Vector3:
return Vector3( deg_to_rad(vect.x), deg_to_rad(vect.y), deg_to_rad(vect.z) )
# Called like:
node.rotation = Util.d2r(new_deg_rotation)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status