camera.constrainedAxis not work?

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

I have set the camera.constrainedAxis as Cesium.Cartesian3.UNIT_Z, but when I rotate the global, I can rotate it any axis. How can I fixed the camera axis when I rotate the global? thanks

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

camera.constrainedAxis = Cesium.Cartesian3.UNIT_Z

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

I want to fix the axis when I rotate the global by mouse drag

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

“cesium”: “^1.37.0”,

Hi there,

constrainedAxis just keeps the camera from rotating past that axis, it doesn’t lock it in place.

We don’t have an out of the box way to get this behavior you describe, but checkout the Camera example. You can subscribe to the Camera.changed event (select “Camera Changed” for the function), and the (select “Set camera reference frame”) so the orientation is always up.

(Also you might want to update to 1.38, it contained a fix that may be relevant to the camera reference frame.)

Thanks!

Gabby