Atlaslog
Atlaslog / Field Notes / 3D & Cesium
Field note · 3D & Cesium

Camera goes below ground and the screen turns black

Quick answer

Holding right-drag upward tilts the view past the horizon until camera height becomes negative, logged as -1840.5 metres, and the frustum points at the geoid. Collision detection or its settings have been disabled.

Last verified 2026-11-03 · Multiple versions · Cite this page
Applies to: CesiumJS 1.121
Symptom
Checklist
  1. Read viewer.scene.screenSpaceCameraController.enableCollisionDetection in the console.
  2. Listen to camera.changed and warn when height drops below 5 metres, printing the call stack.
  3. Grep for flyTo and setView and inspect the destination height literals, since 0 or negative values land underground.
  4. Check minimumZoomDistance, because a value of 0 lets the camera reach the surface.
  5. Check whether terrain is enabled, since collision then tests against terrain height.
Fix

Re-enable enableCollisionDetection, set minimumZoomDistance to 30, minimumTrackBallHeight to 10 and a positive pitch limit, and always give flyTo a positive height such as Cesium.Cartesian3.fromDegrees(116.391, 39.907, 1200) with pitch -35 degrees.

Code
var carto = viewer.camera.positionCartographic;
console.log(Cesium.Math.toDegrees(carto.longitude),
            Cesium.Math.toDegrees(carto.latitude),
            carto.height);
// 116.39 39.90 -1840.5
viewer.camera.changed.addEventListener(function () {
  var h = viewer.camera.positionCartographic.height;
  if (h < 5) {
    console.warn('相机高度过低', h);
  }
});
viewer.camera.percentageChanged = 0.01;
Watch out
All 120 field notesChinese originalRunnable examples
English edition written for Atlaslog from the original Chinese field note. Code is unchanged and runs as-is.
Cite this page

Atlaslog (2026). Camera goes below ground and the screen turns black. https://www.jingweizhi.com/en/cookbook/cesium-camera-underground.html (accessed 2026-11-03).