Skip to content

Commit

Permalink
fix(#9): hide globe when camera is below surface
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Solberg committed Sep 26, 2025
1 parent 251b333 commit fefe11b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/cameraSync.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
}
}
}

0 comments on commit fefe11b

Please sign in to comment.