camera.costrainedAxis ==> An error occurred while rendering. Rendering has stopped.

1. A concise explanation of the problem you’re experiencing.

I’m trying to limit the tilt of the camera (not too near the ground), so I’m using camera.costrainedAxis.

I did some test to understand how it work but I get the error:

An error occurred while rendering. Rendering has stopped.

TypeError: Cannot read property ‘southwest’ of undefined

TypeError: Cannot read property ‘southwest’ of undefined

at M (https://cesiumjs.org/releases/1.61/Build/Cesium/Cesium.js:543:20546)

at I (https://cesiumjs.org/releases/1.61/Build/Cesium/Cesium.js:543:19375)

at O (https://cesiumjs.org/releases/1.61/Build/Cesium/Cesium.js:543:21276)

at M (https://cesiumjs.org/releases/1.61/Build/Cesium/Cesium.js:543:20896)

at I (https://cesiumjs.org/releases/1.61/Build/Cesium/Cesium.js:543:19375)

at O (https://cesiumjs.org/releases/1.61/Build/Cesium/Cesium.js:543:21276)

at M (https://cesiumjs.org/releases/1.61/Build/Cesium/Cesium.js:543:20896)

at I (https://cesiumjs.org/releases/1.61/Build/Cesium/Cesium.js:543:19375)

at O (https://cesiumjs.org/releases/1.61/Build/Cesium/Cesium.js:543:21276)

at M (https://cesiumjs.org/releases/1.61/Build/Cesium/Cesium.js:543:20896)

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

viewer.scene.camera.constrainedAxis = new Cesium.Cartesian3(45, 45, 45); // just for test

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

When tilting, to limit the height of the camera from the ground in 3d mode, because

  1. I don’t want to see the horizon

  2. often times the camera goes under the ground

4. The Cesium version you’re using, your operating system and browser.

1.61

I think the constrained axis has to be a unit cartesian, so you might need to normalize it.

There’s an example using it in the camera Sandcastle:

https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Camera.html

Click “set camera reference frame” to see what it’s doing there. Let me know if you find that helpful.

This sandcastle link is not working. I’m trying to control the tilt in 3d terrain view but is not able to do it. Any hints/example of how it could be done is heartly welcome !