Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Camera Controller can go underground #5837

Closed
ggetz opened this issue Sep 18, 2017 · 28 comments · Fixed by #8504
Closed

Camera Controller can go underground #5837

ggetz opened this issue Sep 18, 2017 · 28 comments · Fixed by #8504

Comments

@ggetz
Copy link
Contributor

ggetz commented Sep 18, 2017

Move the camera while terrain is still loading in:

image

Appeared after #5603

Reported on the forum: https://groups.google.com/forum/#!topic/cesium-dev/50CK4haCIiw

@mramato
Copy link
Contributor

mramato commented Sep 19, 2017

Are you sure #5603 caused this? We specifically allow the camera to go underground during load because otherwise flights and abrupt camera changes wouldn't work correctly. See #4105. If this is differently, please explain how.

@ggetz
Copy link
Contributor Author

ggetz commented Sep 19, 2017

@mramato If this is intended behavior, I'm fine with closing this.

@mramato
Copy link
Contributor

mramato commented Sep 19, 2017

Please feel free to re-open if there is some additional context I'm missing. You might also want to follow up on the forum post. Thanks.

@mramato mramato closed this as completed Sep 19, 2017
@cesium-concierge
Copy link

Congratulations on closing the issue! I found these Cesium forum links in the comments above:

https://groups.google.com/forum/#!topic/cesium-dev/50CK4haCIiw

If this issue affects any of these threads, please post a comment like the following:

The issue at #5837 has just been closed and may resolve your issue. Look for the change in the next stable release of Cesium or get it now in the master branch on GitHub https://github.com/AnalyticalGraphicsInc/cesium.

I am a bot who helps you make Cesium awesome! Thanks again.

@wallw-teal
Copy link
Contributor

#5603 absolutely caused a change in behavior.

I commented in #5603 but I'll copy it here:

The additional call to camera.setView() should not affect its position, at least according to how I understand the documentation. However, it most certainly is affecting the position as commenting out that one line fixes the problem (but leaves #4639 unresolved in some cases).

@ZacBrownBand
Copy link

Any update on this issue?

@ggetz
Copy link
Contributor Author

ggetz commented Jan 8, 2018

@ZacBrownBand, no additional updates. If you could contribute a fix, or continue to narrow down what the problem is, it would help move things along and we would greatly appreciate it!

@gberaudo
Copy link
Contributor

gberaudo commented Jan 9, 2018

@ZacBrownBand, I created #6012 which also fixes this.

@ggetz
Copy link
Contributor Author

ggetz commented Jan 31, 2018

@ggetz
Copy link
Contributor Author

ggetz commented May 4, 2018

@ggetz
Copy link
Contributor Author

ggetz commented May 8, 2018

@hpinkos
Copy link
Contributor

hpinkos commented May 10, 2018

Also reported by @fgamezc in #6581

@hpinkos
Copy link
Contributor

hpinkos commented May 24, 2018

Also reported by @safa833 in #6623

@hpinkos
Copy link
Contributor

hpinkos commented Jul 31, 2018

Also reported by @miniergouzi in #6856

@OmarShehata
Copy link
Contributor

Reported in this forum thread with a video and how to recreate.

@lilleyse
Copy link
Contributor

Came up again in the context of navigating around a point cloud and ending up underground accidentally. I'm curious if anyone knows of any workarounds for this.

@mramato
Copy link
Contributor

mramato commented Sep 24, 2018

@lilleyse the problem is pretty nuanced, You can modify the end of Camera.update to always set _suspendTerrainAdjustment to false and always call _adjustHeightForTerrain and that would prevent the camera from ever going under terrain, however functions like zoomTo/FlyTo will not work as expected near the ground because they will "bump into" lower res terrain and end up at a higher altitude than desired.

@mramato
Copy link
Contributor

mramato commented Sep 24, 2018

We also tweaked this behavior in master to be better, so I would try that out if you aren't already.

@lilleyse
Copy link
Contributor

Yeah I can see some of the tradeoffs.

That workaround is good for the case I'm describing. It would be nice if the camera could apply terrain adjustment if being acted upon by the user but otherwise not. The details may be more complicated than that though.

@bmr74
Copy link

bmr74 commented Nov 7, 2018

I think the adjustment for terrain would be better if it were invoked by the ScreenSpaceCameraController instead of the camera itself. When programmatically controlling the camera, you don't want the camera doing things you didn't tell it explicitly to do. So the responsibility is ill-placed, it should be with the user control of the camera.

Meanwhile this can fixed like so:

var viewer = new Cesium.Viewer('cesiumContainer');

viewer.camera.changed.addEventListener(
function() {
if (viewer.camera._suspendTerrainAdjustment && viewer.scene.mode === Cesium.SceneMode.SCENE3D) {
viewer.camera._suspendTerrainAdjustment = false;
viewer.camera._adjustHeightForTerrain();
}
}
);

https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/#c=jVFdS8MwFP0roQ9bC3KL+Lh2KHXiw9SHiU8FuUtut2iajHx0TPG/m64bbArieUnuyfm4kA4t6yRtybKSadqyipwMLbzsuXTM92NltEepyY6zSa1rPTiAY0sWga9Rr0gACjHrSPu5dJ6iOK01i2iC5l4anWbsc2B6yIal5zGvLrgNafFM1sayG/EWnG9jHhuNDjuC4zEYWiOIlWV5XHbRsw+RhEU1e5xd3Z419fhvU8kaVI4mf7pxr78nuVr7O2MPKWl24voarvHIJslFUji/UzQdyGvZboz1LFiVAuSe2o1CTy5fBv5OHrhzfVSRH02FkB2ToqyTH79RJ4wrdC6+NEGphfygOpkWedSf2ZRBIfXqqSOrcNdL1pfT+UACQJHH8bfLG6OWaE8SvwE

@miniergouzi
Copy link

@bmr74

This problem occurs when the mouse pulley is indented.

64b0euqw67k nrt d alm 9

@ohadmanor
Copy link

viewer.camera.changed.addEventListener(
function() {
if (viewer.camera._suspendTerrainAdjustment && viewer.scene.mode === Cesium.SceneMode.SCENE3D) {
viewer.camera._suspendTerrainAdjustment = false;
viewer.camera._adjustHeightForTerrain();
}
}
);

That's work great! it fix the problem.

@bbehling-trimble
Copy link

I'm still able to get the camera to go under the terrain in Cesium v1.55. Is the fix mentioned by @bmr74 going to be permanent? Seems incorrect to use 'private' class members.

@bbehling-trimble
Copy link

bbehling-trimble commented Mar 18, 2019

Also see this error occur using @bmr74 workaround

seems to only happen when

if (viewer.camera._suspendTerrainAdjustment && viewer.scene.mode === Cesium.SceneMode.SCENE3D)

is added

TypeError: Cannot read property 'southwest' of undefined
TypeError: Cannot read property 'southwest' of undefined
at visitVisibleChildrenNearToFar (http://192.168.56.4:3000/static/js/17.chunk.js:154816:40)
at visitTile (http://192.168.56.4:3000/static/js/17.chunk.js:154733:7)
at visitIfVisible (http://192.168.56.4:3000/static/js/17.chunk.js:154859:14)
at visitVisibleChildrenNearToFar (http://192.168.56.4:3000/static/js/17.chunk.js:154839:7)
at visitTile (http://192.168.56.4:3000/static/js/17.chunk.js:154733:7)
at visitIfVisible (http://192.168.56.4:3000/static/js/17.chunk.js:154859:14)
at visitVisibleChildrenNearToFar (http://192.168.56.4:3000/static/js/17.chunk.js:154843:7)
at visitTile (http://192.168.56.4:3000/static/js/17.chunk.js:154733:7)
at visitIfVisible (http://192.168.56.4:3000/static/js/17.chunk.js:154859:14)
at visitVisibleChildrenNearToFar (http://192.168.56.4:3000/static/js/17.chunk.js:154843:7)
at visitTile (http://192.168.56.4:3000/static/js/17.chunk.js:154733:7)
at visitIfVisible (http://192.168.56.4:3000/static/js/17.chunk.js:154859:14)
at visitVisibleChildrenNearToFar (http://192.168.56.4:3000/static/js/17.chunk.js:154837:7)
at visitTile (http://192.168.56.4:3000/static/js/17.chunk.js:154733:7)
at visitIfVisible (http://192.168.56.4:3000/static/js/17.chunk.js:154859:14)
at visitVisibleChildrenNearToFar (http://192.168.56.4:3000/static/js/17.chunk.js:154843:7)
at visitTile (http://192.168.56.4:3000/static/js/17.chunk.js:154733:7)
at visitIfVisible (http://192.168.56.4:3000/static/js/17.chunk.js:154859:14)
at visitVisibleChildrenNearToFar (http://192.168.56.4:3000/static/js/17.chunk.js:154844:7)
at visitTile (http://192.168.56.4:3000/static/js/17.chunk.js:154733:7)
at visitIfVisible (http://192.168.56.4:3000/static/js/17.chunk.js:154859:14)
at visitVisibleChildrenNearToFar (http://192.168.56.4:3000/static/js/17.chunk.js:154837:7)
at visitTile (http://192.168.56.4:3000/static/js/17.chunk.js:154733:7)
at visitIfVisible (http://192.168.56.4:3000/static/js/17.chunk.js:154859:14)
at visitVisibleChildrenNearToFar (http://192.168.56.4:3000/static/js/17.chunk.js:154843:7)
at visitTile (http://192.168.56.4:3000/static/js/17.chunk.js:154733:7)
at visitIfVisible (http://192.168.56.4:3000/static/js/17.chunk.js:154859:14)
at visitVisibleChildrenNearToFar (http://192.168.56.4:3000/static/js/17.chunk.js:154837:7)
at visitTile (http://192.168.56.4:3000/static/js/17.chunk.js:154733:7)
at visitIfVisible (http://192.168.56.4:3000/static/js/17.chunk.js:154859:14)
at visitVisibleChildrenNearToFar (http://192.168.56.4:3000/static/js/17.chunk.js:154837:7)
at visitTile (http://192.168.56.4:3000/static/js/17.chunk.js:154733:7)
at visitIfVisible (http://192.168.56.4:3000/static/js/17.chunk.js:154859:14)
at visitVisibleChildrenNearToFar (http://192.168.56.4:3000/static/js/17.chunk.js:154830:9)
at visitTile (http://192.168.56.4:3000/static/js/17.chunk.js:154733:7)
at visitIfVisible (http://192.168.56.4:3000/static/js/17.chunk.js:154859:14)
at visitVisibleChildrenNearToFar (http://192.168.56.4:3000/static/js/17.chunk.js:154837:7)
at visitTile (http://192.168.56.4:3000/static/js/17.chunk.js:154733:7)
at visitIfVisible (http://192.168.56.4:3000/static/js/17.chunk.js:154859:14)
at visitVisibleChildrenNearToFar (http://192.168.56.4:3000/static/js/17.chunk.js:154824:9)
at visitTile (http://192.168.56.4:3000/static/js/17.chunk.js:154733:7)
at visitIfVisible (http://192.168.56.4:3000/static/js/17.chunk.js:154859:14)
at visitVisibleChildrenNearToFar (http://192.168.56.4:3000/static/js/17.chunk.js:154824:9)
at visitTile (http://192.168.56.4:3000/static/js/17.chunk.js:154733:7)
at visitIfVisible (http://192.168.56.4:3000/static/js/17.chunk.js:154859:14)
at visitVisibleChildrenNearToFar (http://192.168.56.4:3000/static/js/17.chunk.js:154830:9)
at visitTile (http://192.168.56.4:3000/static/js/17.chunk.js:154733:7)
at visitIfVisible (http://192.168.56.4:3000/static/js/17.chunk.js:154859:14)
at visitVisibleChildrenNearToFar (http://192.168.56.4:3000/static/js/17.chunk.js:154824:9)
at visitTile (http://192.168.56.4:3000/static/js/17.chunk.js:154733:7)

@popoleeMaster
Copy link

I still have this problem with the latest version. In the default exemple, just press the center button on a mouse, drag the mouse around, and release, you will have such a wierd view that was not at all what is intended to be.

@engineerhe
Copy link

@bmr74 your answer does work,Strong!

@cesium-concierge
Copy link

Congratulations on closing the issue! I found these Cesium forum links in the comments above:

https://groups.google.com/forum/#!topic/cesium-dev/50CK4haCIiw
https://groups.google.com/forum/#!topic/cesium-dev/cPbtbShkSOQ
https://groups.google.com/forum/#!topic/cesium-dev/Sn5R5FzOr1k
https://groups.google.com/forum/#!topic/cesium-dev/TDMwlbT0xBE
https://groups.google.com/d/msg/cesium-dev/Mq4i8gC6eAE/-jeRGSn6CAAJ

If this issue affects any of these threads, please post a comment like the following:

The issue at #5837 has just been closed and may resolve your issue. Look for the change in the next stable release of Cesium or get it now in the master branch on GitHub https://github.com/AnalyticalGraphicsInc/cesium.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet