Ground camera collision

I've noticed that the Cesium Viewer app (https://cesiumjs.org/Cesium/Build/Apps/CesiumViewer/) default implements collision detection with the ground surface and the camera (you can't scroll the camera under the world). Is it possible to implement this using Cesium.js too?

Cesium already supports this by default, the app isn’t doing anything special. The one caveat is that if you are tracking an object with the camera, you can still go under terrain. This will be fixed eventually.

Are you seeing different behavior in your app?

Yes. I'd based my code on the 'Set Reference Frame' camera sandcastle and this exhibits the same behaviour so I'd assume it was standard. As it turns out, it's caused by this line:

Cesium.Matrix4.clone(transform, camera.transform);

which after a bit of debugging around appears to the scene's globe to become unavailable.