diff --git a/src/cameraSync.js b/src/cameraSync.js index c2ca8b6..39ca0fc 100644 --- a/src/cameraSync.js +++ b/src/cameraSync.js @@ -23,7 +23,12 @@ export function syncCameras(potreeViewer, cesiumViewer) { const cUp = Cesium.Cartesian3.normalize( Cesium.Cartesian3.subtract(cUpTarget, cPos, new Cesium.Cartesian3()), new Cesium.Cartesian3() - ) + ) + + // Hide globe when camera is below surface + const camHeight = Cesium.Cartographic.fromCartesian(cPos).height + cesiumViewer.scene.globe.show = camHeight >= 0; + cesiumViewer.scene.skyAtmosphere.show = camHeight >= 0; cesiumViewer.camera.setView({ destination: cPos, @@ -41,4 +46,4 @@ export function syncCameras(potreeViewer, cesiumViewer) { const fovx = Math.atan(Math.tan(0.5 * fovy) * aspect) * 2 cesiumViewer.camera.frustum.fov = fovx } -} +} \ No newline at end of file