I'm trying to add a button to a Cesium App that reorients the user to a North is up, View straight down, roll is nullified orientation. I want the camera position to remain the same, just update the heading, pitch, and roll. In 2D mode, the camera position changes when I make this call, even though it seems like it shouldn't. Code to reproduce this effect in the Sandbox is listed below:
JS:
var viewer = new Cesium.Viewer('cesiumContainer');
viewer.scene.morphTo2D();
var btn = document.getElementById('btn');
btn.addEventListener('click', function(){
viewer.scene.camera.setView({
roll: 0,
pitch: -Cesium.Math.PI_OVER_TWO,
position: viewer.scene.camera.position,
heading: 0
});
});
HTML:
<style>
@import url(../templates/bucket.css);
</style>
<div id="cesiumContainer" class="fullSize"></div>
<div id="loadingOverlay"><h1>Loading...</h1></div>
<div id="toolbar">
<button id="btn">rotateNorthUpDown</button>
</div>
Am I doing something incorrectly, or is this a bug with setView in 2D mode?
Thanks,
Scott