fix: ensure <GizmoHelper />
rotations respsect camera up direction
#1330
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.
Why
This change resolves an issue when using the GizmoHelper with a non-standard "up" vector for your world (e.g. +Z up rather than the default +Y). By setting the up vector when computing each tweened rotation for the animation, the world up can be presevered and avoid the flicker to set the camera position up after the animation completes.
To demo this change, create a scene with a camera that has
up={[0, 0, 1]}
using a gizmo to view the behaviour where the view "snaps" to it's final position and does not obey the up vector during the animation.While this resolves this issue, the
GizmoViewport
will still be presented in the default world orientation (i.e. with +Y up) which should be addressed in a separate PR.Relates to #522
What
When computing the quaternion rotation to apply, the
mainCamera
up vector is included to ensure the rotation remains upright.Checklist