Correct rotation gizmo plane math for off-center perspective view #95402
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.

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

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.

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.