Problem with pinning of view to a certain location.


I used the example

to implement pinning of view to a certain location.

However, the problem is that when I am doing it, the camera "flies" to some location ( as specified in the call to camera.lookAtTransform(transform, position).

What I need is when I am clicking on a globe (creating an object at the location that I clicked on), I need to pin the view to that location but I don't want the camera to move at that moment.

I tried using camera.setView(...), but it causes camera to "fly" to that location.

Here is my code: (x,y) is the Windows click coord.

var position = camera.pickEllipsoid({x:x, y:y}, ellipsoid);
var cameraViewData = {
            'destination' :,
             'orientation' : {
               'heading' :,
               'pitch' :,
               'roll' :

var transform = Cesium.Transforms.eastNorthUpToFixedFrame(position);
camera.constrainedAxis = Cesium.Cartesian3.UNIT_Z;
//the following line causes camera to move, but without it the view isn't pinned to the location when zooming in/out.
camera.lookAtTransform(transform, position);

//flies to the location, but I want to keep the same view as it was before I called this function to pin the view
camera.setView( cameraViewData );

Thank you,


Hi Greg,

If I understand correctly, I think you just want:


The offset is optional. If it is undefined, the camera position and orientation will remain the same, but in the new reference frame.



I tried that, but then the view is only "pinned" when rotating, but not when zooming (thus doing only half of what I need). I need it to stay pinned when zooming as well.

Thank you,


Hi Greg,

Using camera.lookAtTransform should keep the camera pinned when zooming.

Take a look at the ‘Set Camera Reference Frame’ part of this demo:

If it’s still giving you problems, can you paste a code example? Maybe there’s a bug.