Skip to content
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

Correct rotation gizmo plane math for off-center perspective view #95402

Merged
merged 1 commit into from
Aug 16, 2024

Conversation

MajorMcDoom
Copy link
Contributor

@MajorMcDoom MajorMcDoom commented Aug 11, 2024

Summary

The rotation gizmo currently uses the camera's forward vector to determine the plane of interaction. This works fine in ortho viewports, and works in perspective viewports if the gizmo is near the center of the viewport. As the gizmo gets closer to the peripheral of the viewport, this results in the gizmo selecting the incorrect style of interaction (scrolling vs winding), and it also results in incorrect rotation when using view-aligned rotation. Below are GIFs of the three cases, comparing the old and new, corrected behaviour.

Fixes: #95367

Linear Scrolling Tangential to Axis

In this case, the old behaviour incorrectly determines that it should use a radial interaction, and can choose an incorrect winding direction as well.
Linear

Radial Winding Around Axis

In this case, the old behaviour incorrectly determines that it should use a linear interaction.
Radial

Radial Winding in View-Space

In this case, the old behaviour rotates the object around an inaccurate axis, causing the view of the object to change as you rotate it. The new behaviour uses the correct axis, and keeps the object visually consistent as you rotate it.
View

Additional Notes

I've also slightly adjusted the orthogonal angle threshold for distinguishing between scroll/winding by 3 degrees, as the old threshold was determined whilst having to account for the erroneous behaviour. The new value makes it slightly easier to choose the linear scrolling interaction.

@MajorMcDoom MajorMcDoom requested a review from a team as a code owner August 11, 2024 19:58
Copy link
Member

@clayjohn clayjohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense! It's great to see someone giving some attention to 3D editor usability!

Copy link
Member

@TokageItLab TokageItLab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the changes in the code, it seems to be a quite safe fix since it just changes the axis.

@akien-mga akien-mga added the cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release label Aug 16, 2024
@akien-mga akien-mga merged commit 3ba9f43 into godotengine:master Aug 16, 2024
18 checks passed
@akien-mga
Copy link
Member

Thanks!

@akien-mga
Copy link
Member

Cherry-picked for 4.3.1.

@akien-mga akien-mga removed the cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release label Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants