Switching shift/control+mouse camera behavior

In Cesium, Shift+Click+Dragging changes view while leaving the camera stationary and Control+Click+Dragging leaves the view point stationary while moving the camera. In the Google Earth plugin and in the Google Earth application, the Shift/Control dragging behavior is the opposite.

Is there example code that shows how to change this? I know how to trap for the shift and control keys (I'm doing that in conjunction with the arrow keys to mimic Google Earth's camera behavior), but I don't know how to change the behavior in Cesium.



Cesium has a class ScreenSpaceCameraController for setting which input control the camera. You can switch the modifiers on look and tilt to get the behavior you want. Here is an example:

var viewer = new Cesium.Viewer(‘cesiumContainer’);
var cameraController = viewer.scene.screenSpaceCameraController;
cameraController.lookEventTypes.modifier = Cesium.KeyboardEventModifier.CTRL;
cameraController.tiltEventTypes[2].modifier = Cesium.KeyboardEventModifier.SHIFT;
cameraController.tiltEventTypes[3].modifier = Cesium.KeyboardEventModifier.SHIFT;




Perfect! Thanks Hanna!

בתאריך יום חמישי, 28 באפריל 2016 בשעה 20:03:52 UTC+3, מאת steven...@gmail.com:

Perfect! Thanks Hanna!

Hi, When Pressing CLICK + CTRL and releasing, tilt camera status is locked.
How to cancel that ?

Hi there,

Checkout the camera documentation for enableTilt: http://cesiumjs.org/Cesium/Build/Documentation/ScreenSpaceCameraController.html?classFilter=camera#enableTilt

Hope that helps,

  • Rachel