-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Added maximumTiltAngle to limit how much the camera can tilt #12169
Conversation
Thank you for the pull request, @albek446! Welcome to the Cesium community! In order for us to review your PR, please complete the following steps:
Review Pull Request Guidelines to make sure your PR gets accepted quickly. |
Let's go! Sign it bro! |
Still waiting for approval before I can send in the CLA. But I am still working on it |
…the camera can tilt
f75d171
to
d143143
Compare
I can confirm we now have a CLA on file! @lukemckinstry Could you please take a pass on reviewing this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for submitting this PR to fix this long running issue. This fix seems to work as intended.
I know I have encountered this error myself, but following the basic instructions from the original/primary forum thread https://community.cesium.com/t/how-to-limit-tilt/14459 I was surprised to be having trouble reproducing the error on a plain ellipsoid.
Using a mouse we can easily and consistently end up “under ground” or get “lost” in the scene by clicking on the globe and moving the mouse to tilt the scene to both extremes (+/- 90 degrees) repeatedly. The severity of the problem caused in the scene depends on the zoom level.
But shifting to some non plain ellipsoid examples, like
-
this underground sandcastle example from a similar (possibly overlapping) issue View rotation gets stuck near ground #12137
-
a basic example with Cesium World Terrain
const viewer = new Cesium.Viewer("cesiumContainer", {
terrain: Cesium.Terrain.fromWorldTerrain(),
});
I was able to reproduce the error and confirm the fix worked when I set maximumTiltAngle
equal to Math.PI / 2
One comment I would like to raise: I think putting the property in radians is a good call. It seems like most users want to prevent tilting/rotation underground (based on the github issues and forum comments) so I think we could do users a favor by adding an example to the doc string like I commented below to show how.
What do you think?
canvas.clientHeight / 4 | ||
); | ||
|
||
moveMouse(MouseButtons.MIDDLE, startPosition, endPosition); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why repeat this mouse move? If it is valid can you add a comment to explain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Certainly.
The reason why I repeated the mouse move was because I could not find a way to get the tilting angle to 45 degrees (0.25π radians) in just one move. I tried to set the endPosition to different values but could not get the final tilt angle high enough to the limit I wanted to test. Maybe I am missing something, and there is a better way?
Hey @ggetz I think this is ready for a second review |
Thanks @albek446 and @lukemckinstry! @albek446 Please merge in the latest |
@ggetz I have now merged in the latest updates from the main branch and run the prettier steps. |
@ggetz any update on this? Was my last update ok? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates here @albek446!
I've tested this out, and it's working very well in both 3D and CV modes.
I made a few small adjustments to the inline documentation, and moved the change note to the next upcoming release. This should be good to merge once CI checks pass!
Description
Added a maximumTiltAngle property in the ScreenSpaceCameraController which, if set, limits the camera's tilt.
The maximumTiltAngle value is expressed in radians.
Issue number and link
Fixes #9689
Author checklist
CONTRIBUTORS.md
CHANGES.md
with a short summary of my change