Different mouse behavior after lookAt than flyTo

Perhaps this is expected behavior, but - after using lookAt, clicking + dragging will tilt/rotate and map (as if I were holding down ctrl) instead of simply panning the map, as expected. After using flyTo, clicking + dragging pans the map as usual.

I’d like to use lookAt because I can provide it with a “range” value, which I cannot do with flyTo. However, the behavior of click+drag afterward renders the map unusable for me.

Is it possible to change this so that I can pan/zoom as usual after lookAt?

You could override the mouse behaviors to disable the drag.
This camera demo shows how to control the mouse events.

That is an interesting idea - however, I don’t want to disable the drag. Rather, I’d just like the user to be able to pan/zoom the map, as in the default state of the Cesium viewer. This is the behavior after flyTo, I’m not sure why lookAt is different. Perhaps I can use screenSpaceCameraController to accomplish what I want, as you suggest. But I’m not sure why the map behavior changes after lookAt as opposed to flyTo.

Andrew, this is simple to do, you just need to add a call to camera.lookAtTransform(Cesium.Matrix4.IDENTITY). Here’s a complete example.

var viewer = new Cesium.Viewer(‘cesiumContainer’);

var center = Cesium.Cartesian3.fromDegrees(-98.0, 40.0);

var cameraPos = new Cesium.Cartesian3(0.0, -4790.0, 3930.0);

viewer.camera.lookAt(center, cameraPos);

viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);

1 Like

That worked great - thank you!