I am using the Camera.setView API to specify a position (including height), heading, pitch and roll. For example:
viewer.camera.setView({
positionCartographic: Cesium.Cartographic.fromDegrees(-71.304006, -33.378611, 0),
heading: Cesium.Math.toRadians(41.5725784302),
pitch: 0,
roll: 0
});
What I'm seeing is that immediately after this call, if I check the camera position height via:
viewer.scene.globe.ellipsoid.cartesianToCartographic(viewer.camera.position).height
this value is 0. However, if I wait several seconds after the setView call (with no further changes or user interaction), the height is reported as 512.8532641851385. At that point I can then call viewer.camera.setView, again specifying a height of 0, which results in the height actually being set to 365.16182601730156.
What I actually see in the browser window is, initially, the camera is clearly well above ground level. After the second call to viewer.camera.setView, however, the camera is either at ground level or at least reasonably close to it.
The above numbers are using a terrain server. I see the same delayed-height-change behavior without the terrain server, though the numbers are much lower.
This leads to several questions:
1. What is causing the delayed height shift? Is it due to trying to change height, pitch and roll all at the same time? Or is it due to a delay in retrieving terrain data?
2. How can I perform another action (changing the height) after #1 (whatever it is) has completed?
3. I'd like to confirm - I'm guessing I can only get as low as 365 is because that is what the terrain server is reporting as the elevation for this point?