How to prevent camera tilt/rotation?

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

I am unable to find a way to prevent the camera from tilting or rotating when using the map in the ‘globe’ view. When viewing a flat map there is no problem, but using the flat map is not an option for my application.

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

I’ve attempted to constrain the axis using :

camera.constrainedAxis = Cesium.Cartesian3.UNIT_Z;

``

but there is no disernable change.

I’ve also attempted to set defaultLookAmount and defaultRotateAmount to 0 and that has no impact on behaviour of the camera.

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

The look and rotate are unnessesary for my application, and make navigating/zooming on mobile nearly impossible. The globe constantly turns and tilts, often resulting in a misconfigured map that needs to be refreshed to return to home.

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

Currently using 1.6, Kubuntu and Firefox, but this issue is common to all major OS and browsers.

Hey Stephen,

Have you tried disabling tilt on the camera controller?

viewer.scene.screenSpaceCameraController.enableTilt = false;

``

There’s a few other options you can disable there too. This camera code example disables all camera movement and overrides it with keyboard controls (for your case it would be a good reference just to see how to disable the various interactions):

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

You may also want to override the home button to go to a view/with your custom logic, that way the user doesn’t have to refresh to get back to some home state in your application:

viewer.homeButton.viewModel.command.beforeExecute.addEventListener(function (e) {

e.cancel = true;

// Add any custom code here, such as flying to some saved view.

});

``

Let me know if this helps!

That worked! Thanks Omar!