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 the issue where camera zoom get stuck when looking up #9126

Merged
merged 5 commits into from
Sep 1, 2020

Conversation

baothientran
Copy link
Contributor

Currently the camera zooming is stuck when looking up to the target. It is because the math for zooming assumes the camera is always looking down to the earth surface. The fix is to check the angle between the camera direction and the earth-origin-to-camera direction. If they are less than 120 degree, it looks up and we choose the method zoom-on-vector. Theoretically, we should check for 90 degree, but in practice, it doesn't work really well.

@lilleyse Can you please take a look at it? Please let me know if I should add anything

@cesium-concierge
Copy link

Thanks for the pull request @baothientran!

  • ✔️ Signed CLA found.
  • CHANGES.md was not updated.
    • If this change updates the public API in any way, please add a bullet point to CHANGES.md.
  • ❔ Unit tests were not updated.
    • Make sure you've updated tests to reflect your changes, added tests for any new code, and ran the code coverage tool.

Reviewers, don't forget to make sure that:

  • Cesium Viewer works.
  • Works in 2D/CV.
  • Works (or fails gracefully) in IE11.

@baothientran
Copy link
Contributor Author

@lilleyse This is the sandcastle to replicate the problem. If you look up to the ceiling, it will get stuck in the master branch

@lilleyse
Copy link
Contributor

lilleyse commented Sep 1, 2020

@baothientran Nice fix! I can confirm this fixes the bug where the camera gets stuck when zooming towards a surface above it. This change also has the positive side effect of improving navigation at higher elevations (above 3000) because it now favors the zoomOnVector behavior except for bird's eye views. Zooming around Mt. Everest is less jolty than before.

@lilleyse lilleyse merged commit b84b70a into master Sep 1, 2020
@lilleyse lilleyse deleted the camera-zoom branch September 1, 2020 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants