Any plan on collision detection method between the viewpoint and the terrain?

Hi, all,

When terrain is added, the viewpoint can get through the ground. Is there any plan on collision detection?

Thanks,
Shawn

Hi Shawn - there is. Keep an eye on #449.

Patrick

I'm going to fix this issue by myself. My plan is save the height map when loading. Not all height map data , only some high point. Then, check the camera height with the height map during moving. But cesium code is too complex. Could anybody tell me the can add these code. For example, tell me which file and which function I should read.

Shawn

I found, I should modify these two functions, to avoid camera get into ground.

CameraController.prototype.move()
CameraController.prototype.rotate()

I'm finding the way to get the height map.

Can I get the height of any point on a mountain, with terrain data?

Yes. See the “Sample Everest Height” example in the Terrain Sandcastle example.

Patrick

Hi, all,

I almost solved this issue, but not perfect.I get ground height by sampleTerrain() in rotate() and move() call. And compare to current camera height. If camera get into ground then let it out. sampleTerrain() is an async function, cannot get ground height real-time. The result is, camera gets into ground firstly, user can see the black starry sky. Then jump out ground about 0.1 second later. If I keep camera height 30 meters up to ground, and move camera not very fast, camera will not get into ground finally.

Thanks,
Shawn