Reset to North

Hello,

Is there an easy way to calculate the transformation needed to reset the camera so it shows the current view in a North orientation? Similar to what clicking on ‘Reset to North’ button on google earth compass does.

Thanks,

Teme

Hello Teme,

I believe this should work:

var camera = viewer.camera;
camera.setView({
    orientation: {
        heading : 0
    }
});

``

Best,

Hannah

Thanks Hannah! That seems to work.

Hey Hannah, it would be very cool if there was a way to rotate the camera’s orientation with a smooth animation (just like flyTo) instead of just setting it to it’s final value, any plans to implement this?

Actually, you can use similar options for flyTo:

var camera = viewer.camera;

camera.flyTo({

destination: camera.positionWC,

orientation: {

heading : 0,

pitch: camera.pitch,

roll: camera.roll

}

});

``

-Hannah

Works great! thanks