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,
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
@hannah is there a better solution? Because when the camera is angled, it turns away from what you’re looking at. I need a rotation that preserves what’s in the center of the view.
Hello Hannah,
I’m trying to use flyTo() in 2d mode, try to change current view in a North orientation:
viewer.camera.flyTo({
destination: viewer.camera.positionWC,
duration: 0.5,
orientation: {
heading: 0,
pitch: viewer.camera.pitch,
roll: viewer.camera.roll,
},
});
but the camera behaves quite strangely, when using the same parameters, the camera changes its appearance, as for 3D, the function works fine there, I left an example in the sandcastle.
Thanks,
Ilya