I get a discrepancy between the viewer’s zoomTo() and flyTo() methods when I specify the offset. Zoom is rotated the way I want, but fly isn’t. The discrepancy is the same whether in 2D or 3D. And in both cases, the range/height offset value is ignored. Here’s my code:
var viewer = new Cesium.Viewer(‘cesiumContainer’, {
navigationHelpButton: false,
navigationInstructionsInitiallyVisible: false,
baseLayerPicker: false,
geocoder: false,
timeline: false,
animation: false,
sceneMode: Cesium.SceneMode.SCENE2D,
baseLayerPicker: false,
imageryProvider: provider
});
var heading = Cesium.Math.toRadians(90);
var pitch = Cesium.Math.toRadians(-30);
var height = 10000;
if (viewer.dataSources.length > 0) {
//loop through datasources to find entities with the selected object’s id.
for (var x=0;x<viewer.dataSources.length;x++) {
var matchingEntity = viewer.dataSources.get(x).entities.getById(objectId);
if (matchingEntity != undefined) {
viewer.flyTo(matchingEntity, new Cesium.HeadingPitchRange(heading, pitch, height)).then(function(result){
if (result) {
viewer.selectedEntity = matchingEntity;
}
});
}
}
}
``
The attached images show the effects of both methods, with me manually zooming in since the range didn’t work.