Problem with pinning of view to a certain location.

Hello,

I used the example http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Camera.html&label=Showcases

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' : this._ctx.camera.position,
             'orientation' : {
               'heading' : this._ctx.camera.heading,
               'pitch' : this._ctx.camera.pitch,
               'roll' : this._ctx.camera.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,

Greg

Hi Greg,

If I understand correctly, I think you just want:

camera.lookAtTransform(transform);

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

Dan

Daniel.

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,

Greg

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: http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Camera.html&label=Showcases

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

Thanks,

Hannah