Camera collision constraint within a model

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

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?

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.

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

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?

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

This is the main GitHub issue for discussing this feature: https://github.com/CesiumGS/cesium/issues/4802

Looks like the work was just never completed, based on the comments here: https://github.com/CesiumGS/cesium/pull/6381#issuecomment-385014381. 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

1 Like

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.

Whats the unit of _maximumUndergroundPickDistance for example?
cameraController._maximumUndergroundPickDistance = 80000.0;

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?

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

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