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

fix: ensure <GizmoHelper /> rotations respsect camera up direction #1330

Merged
merged 1 commit into from
Mar 13, 2023

Conversation

mdtusz
Copy link
Contributor

@mdtusz mdtusz commented Mar 4, 2023

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

  • Storybook entry added
  • Ready to be merged

@vercel
Copy link

vercel bot commented Mar 4, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
drei ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 4, 2023 at 11:31PM (UTC)

@codesandbox-ci
Copy link

codesandbox-ci bot commented Mar 4, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 7cf0017:

Sandbox Source
priceless-water-2lth9e Configuration
Ground reflections and video textures Configuration
arc-x-pmndrs-colors Configuration

@drcmda
Copy link
Member

drcmda commented Mar 13, 2023

thanks!

@drcmda drcmda merged commit a9b8931 into pmndrs:master Mar 13, 2023
@github-actions
Copy link

🎉 This PR is included in version 9.57.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@mdtusz mdtusz deleted the gizmo-up branch April 24, 2023 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants