Weird camera behavior in latest Cesium

After updating to Cesium 1.8 from a older version (1.6 I think), we had to change many camera calls (lookat mostly I think).

However the problem is that it seems calling camera.lookAt() now seems to change the mouse behavior?

For example, I want to set the camera initial position at our app start up.
Check the following code:

        var center = Cesium.Cartesian3.fromDegrees(-9.1365, 38.7075);
        var heading = Cesium.Math.toRadians(0.0);
        var pitch = Cesium.Math.toRadians(-20.0);
        var range = 10000000.0;
        camera.lookAt(center, new Cesium.HeadingPitchRange(heading, pitch, range));        


Having this code at the app startup does change the camera position, but also it seems it locks the mouse rotation of the globe around some fixed point?

If comment this code, clicking the right button and dragging it allows to rotate the globe (and the position where I click matters). Of course, the camera appears at a default zoomed out position.

Anyway, if I let this code run, it will lock the globe rotation, and from that point on, it is not longer possible to navigate the globe at all, just rotate around this point…

Is this the intended behavior?

If yes, please update the documentation better and suggest what other method I should use that does not cause this weird behavior, because I just want to change the camera position, and this is doing something else.

That is the intended behavior. The idea was that if you look at something then it should be locked in view. You can easily change back to the default with


which doesn’t change the camera position or orientation at all but makes the Earth the center of the camera reference frame.

I believe Bagnell accidentally omitted the 4, it should be

Daniel, I’m not sure if I understood.
So you’re saying to obtain the behavior I want (setting the camera position, but without locking it to a point) I should first call lookAt() followed by lookAtTransform() with an identity matrix, is this correct?

.lookAt is a very simply wrapper function for .lookAtTransform, all it does is make the transform be the ENU transform of the target

If .lookAtTransform lacks an offset argument it will only set the camera’s transform

Cesium.Matrix4.IDENTITY is the transform for Earth, where up is the north pole

Actually the camera is always ‘locked to a point’ using the default controls, Cesium.Matrix4.IDENTITY makes Earth’s center that point.