CesiumGS / cesium

An open-source JavaScript library for world-class 3D globes and maps :earth_americas:
https://cesium.com/cesiumjs/
Apache License 2.0
12.74k stars 3.45k forks source link

When set height of camera's destination with 0.0,throw a exception in 2d. #7836

Open RenZachary opened 5 years ago

RenZachary commented 5 years ago

link. run the following code,then select 2d mode,and click button [Zoom]: At the same time,the height is close to 0 ,the page crashed without exception message(2d). image

code:

var viewer = new Cesium.Viewer('cesiumContainer', {
    //sceneMode:Cesium.SceneMode.SCENE2D,
    terrainProvider: Cesium.createWorldTerrain()
});
Sandcastle.addDefaultToolbarButton('Zoom', function() {

    viewer.camera.flyTo({
        destination : Cesium.Cartesian3.fromDegrees(108.5,33.5, 0.0)
    });
});
OmarShehata commented 5 years ago

Thanks for reporting this and for the minimal code example! I think this is an issue of CesiumJS allowing the camera to go beyond what it expects. The error is thrown in OrthographicOffCenterFrustum.js:

https://github.com/AnalyticalGraphicsInc/cesium/blob/b7c1e301291a3916c4cfc30ff6ab8a6103fbf687/Source/Core/OrthographicOffCenterFrustum.js#L120

I think the viewer/camera fly to should prevent this camera from going in this position.