ka_sc
July 6, 2020, 9:56pm
1
hi,
Is there support to something like this: Keep camera from flying through a model while allowing it to be inside the models bounding box/sphere?
We have large ditch shaped models where there is valid reason for the camera to be inside the model but flying through the side walls can be confusing for users. My understanding is that collision is depth value based now. So only works for things that are in view.
Same question for tile sets long term. Is it any different? Are those assumptions still valid:
https://groups.google.com/forum/#!topic/cesium-dev/mEA1Rs8xw-Y
omar
July 7, 2020, 9:36pm
2
Do you mean that you want the camera to actually go through some parts of the geometry, but not others? Or do you want to just be able to move freely without going through any surface?
Do you have a screenshot or Sandcastle example you can share showing the issue?
ka_sc
July 9, 2020, 10:17am
3
Something like this and I noticed some parts can be below terrain (so we have to turn off terrain collision). So ideally we want the camera inside this but no through the ground or walls. I guess a lot of things at once.
omar
July 10, 2020, 7:06pm
4
So you should be able to turn off collision with the terrain itself to allow the user to freely move here, like this blog post explains: https://cesium.com/blog/2020/06/16/visualizing-underground/ (see links to code examples at the end).
I think that should work. The other route is implementing your own camera controller like here: https://sandcastle.cesium.com/index.html?src=Camera%20Tutorial.html . Youād have to handle collision yourself, such as perhaps by using scene.pickPosition
each time the camera moves (or with the techniques Sean describes in the post you linked 3dTiles bounds and collision detection ).
1 Like
ka_sc
July 11, 2020, 1:43am
5
hi,
I did some experiments with the camera underground after updating to the latest version and i think we likely have to use both.
I update once I have a good solution, I wanted to check out this approach as well
cesium: camera-limiter . Do you happen to remember why it didnāt get merged?
ka_sc
July 12, 2020, 9:50pm
6
Ah and would we expect minimumZoomDistance to still work with the camera undergrund? Like a value of -50m for example? It didnāt when i tried
omar
July 12, 2020, 10:49pm
7
This is the main GitHub issue for discussing this feature: Camera boundry Ā· Issue #4802 Ā· CesiumGS/cesium Ā· GitHub
Looks like the work was just never completed, based on the comments here: Limit Camera's Position by hanbollar Ā· Pull Request #6381 Ā· CesiumGS/cesium Ā· GitHub . If you do get a chance to test this and finish it, I think weād happy to look at a new pull request!
I think this is ignored when going underground, there is a somewhat related āunderground pick distanceā (this would control whether you can orbit the camera around points underground) that isnāt yet part of the public API, you can see this discussion here: Camera behavior after update to version 1.70 - #3 by sean_lilley
1 Like
ka_sc
July 18, 2020, 1:08am
8
We havent quite decided yet but the camera limiter approach seems the most promising.
For limiting zoom i looked at these but i am still confused.
I have modified this sandcastle a little bit, with the settings of the viewer, which are used in our case and set ._maximumUndergroundPickDistance to 80000.0
Unfortunately, I canāt restore the old (<1.70) camera behavior with this setting.
The area marked as ā1ā in the screenshot above is slightly extended by modifying this setting, but as soon as the camera is just a little bit deeper in the space of the earthās interior, the camera turns around itself again when clicking the mouse wheel, likā¦
Whats the unit of _maximumUndergroundPickDistance for example?
cameraController._maximumUndergroundPickDistance = 80000.0;
CesiumGS:master
ā CesiumGS:camera-underground-controls
opened 04:03PM - 29 Apr 20 UTC
Opening this PR for early testing. There's still some work to be done, especiallā¦ y for panning. While I had the urge to rewrite `ScreenSpaceCameraController` I took the opposite approach and just modified camera behavior when underground. Above ground controls should be the mostly same, for better or for worse.
At a high level the changes include:
- Added ability to zoom into the ground, like submerging below the terrain. This happens by default if `enableCollisionDetection` is false and `minimumZoomDistance` is greater than 0.0. I'm occasionally noticing large jumps which I still need to fix.
- Changed zooming, rotating, and panning behavior when underground. There's a new property in `ScreenSpaceCameraController` called `undergroundSurfaceHeight` which acts as an invisible ellipsoid that's used to improve camera navigation when underground. For best results the height should be set just below the height of underground entities in the scene.
- When underground, the zoom distance is now determined by the position over the mouse's cursor rather than the position at the center of the screen. This should make it a lot easier to navigate to underground datasets.
- Fixed what seemed like a kludge in the camera panning code which had the side effect of panning every other frame. Basically panning felt like 30hz while other camera controls felt like 60hz. Panning feels so much smoother now.
[Local sandcastle for testing](http://localhost:8080/Apps/Sandcastle/index.html#c=5Vptd9s2lv4rXH+xPFVggAABwk4yEzvuNGfcJCdJ29NdzweKgi2e0KQOSTlRd/Lf97mkKJGUnMjZpPNh2p5awsvFxXPfL3QXFd5d4j64wnviZe6Dd+7KZHHLfq3HRlcHcf39PM+qKMlccXUw9v73KvO84+P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FVqWN0PHkG+Y2p5/9QfNAU1vJed/V15h/ysmds+lhZvjZKT+xIbe7r8nfuhyZ3RGIqfw3Wn+c0IK5pm3yqDORgfPC6rZeqetsv/ltzO86KiX/6NGDuu3O08hX2Xx5MF3G7F4rJcUfAeH3e3Pp4md14yfbLjN7PNbz0wc71I07fJH/BPTx8fY/3W1jSvcXx154o0WtKymXh62Qwyxh4f4+vunevHkfVNHlcUQ55uoujjapJPl50BGip632lk+rT7y1xv9eLw+BgT20v7IxhLMjL4ajl3hATFKqSogGAaVdEj8hPtcPNUtfVy0bnAiuLwYAwUe1zixwg2PVkiIW56yN/lAv029Tfj/S31We/qvmp97nfhvd+7/Xa404OIR016rw57X8U79OIGcHq3SYZv9JyIz9FHfBb1Z/j7eT0hBre7o5eE4avM2KuHf6kb0yjC6qMOt248ZKJyHys6CwaLb8E+J30zFM8Qt//dIA7eir4fhr2DvhmEv2xeQJq3fC/6t0F5z8vO94N054EPhhZfeyED3zsxpRuI/g8)

@fredj @gberaudo
Looks like undergroundSurfaceHeight got removed again in the end, in favour of:
If someone needs an underground distance limiter, it might make more sense for them to place a large underground ellipsoid. Is this an example on how to that Cesium Sandcastle ? And can you have collision with that ellipsoid then?
ka_sc
July 24, 2020, 12:55am
9
So can we have collision with just a custom underground ellipsoid to prevent cameras from going more that lets say 50 m below ground?
Somethng like mantle layer in this
Can make a custom method for preventing the camera from going too deep
Funny moment underground
Can alter one of the lines to:
var edist = camera_height-terrain_height-50;
1 Like
ka_sc
July 26, 2020, 6:21am
11
Thanks, I give that a try. Also managed to look the camera into a sphere. Not the greatest user experience i still have to think about making it nicer