godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.07k stars 69 forks source link

Allow using axis and angle combinations for rotation edit mode #9422

Open sinewavey opened 3 months ago

sinewavey commented 3 months ago

Describe the project you are working on

image

The Godot editor shows a few options for editing an object's transform. Among them are quaternions, commonly used in 3D space.

Personally, I find quaternions a bit easier to conceptualize given the construction through an axis-angle combination. This is something Godot handily offers in its Quaternion class constructor.

Describe the problem or limitation you are having in your project

Actually using the Quaternion rotation mode is a bit of a difficult operation, and doesn't often provide any real insight (in the editor mode)

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Proposal: add an 'axis-angle' option to the list...

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

image

...and use the existing quaternion Vector4-like input to define:

quaternion = Quaternion( Vector3(axis.x, axis.y, axis.z), angle )

If this enhancement will not be used often, can it be worked around with a few lines of script?

For practical use in code and projects, sure, but providing a useful way to interface with quaternions visually in the editor would probably be a bit more.

Is there a reason why this should be core and not an add-on in the asset library?

While this may not be the case, it seems to me (as a newcomer) Godot certainly aims to to capture and engage with new developers and programmers of all skill levels.

Beyond completeness' sake, as mentioned, I believe it's a much better way to expose this option to users, visually in the editor.

fire commented 3 months ago

I have a pull request for this but should the axis angle be stored as a Vector4(axis.x,axis.y,axis.z,angle) or axis angle axis Vector3() and axis angle angle real_t?

lyuma commented 3 months ago

I think this is something that should rather be improved in the editor inspectors for Quaternion (and also the Transform3D / Transform2D). See how there is a pencil button on Quaternion but it currently only supports eulers.

I don't think any user actually wants to type Quternions or matrices into these fields, so instead of modifying logic specific to Node3D, we should improve the inspector widgets for all Quaternion and Transform3D/2D in the engine.

fire commented 3 months ago

I made a patch here but I wasn't able to get the rotation to be smooth.

d6c8c5ba01b1d5c7c2d78379d5605c964a1b2782.patch.txt