Save a camera view rectangle and later fly to this rectangle with recorded camera angle.

Hi. I’m new in Cesium .

I’m faced with a problem. I can save a camera view recangle. Some time later I want to fly saved rectangle. But I want to look this rectangle with recorded camera position, heading pitch value

I have a solution. I saved this heading and pitch value When recording view rectangle. And in flyToMethod complete property called lookAt function for look from camera with recorded heading ,pitch transform values. But this solution not enough for me .Because firstly camera look above and suddenly look with an angle As a result this cause a ugly animation.

Can I solve this problem with Cesiım flyTo method or anything else?

Thanks

Esra ERİK

Hello Esra,

Here is an example for saving and loading a camera view:

var viewer = new Cesium.Viewer(‘cesiumContainer’);
var camera = viewer.scene.camera;
var position;
var orientation = {
heading: 0,
pitch: 0,
roll: 0
};

Sandcastle.addToolbarButton(‘Save’, function() {
position = camera.positionWC.clone();
orientation.heading = camera.heading;
orientation.pitch = camera.pitch;
orientation.roll = camera.roll;
});

Sandcastle.addToolbarButton(‘Load’, function() {
viewer.scene.camera.flyTo({
destination: position.clone(),
orientation: orientation
});
});

``

Best,

Hannah

Hello Hannah,
Sorry I wrote same question multiple times. and thanks your answer .I’ll try it .

13 Şubat 2017 Pazartesi 18:46:38 UTC+3 tarihinde Hannah Pinkos yazdı:

Hello Hannah.
I try your solution.It’s run perfectly .

Thank you so much your help .

Best.

13 Şubat 2017 Pazartesi 18:46:38 UTC+3 tarihinde Hannah Pinkos yazdı:

Great! Glad to help

-Hannah