Is there anyway to change the viewer perspective so that you are on the ground looking up at the sky instead of looking down on the Earth?
Any help would be great!
Emily
Is there anyway to change the viewer perspective so that you are on the ground looking up at the sky instead of looking down on the Earth?
Any help would be great!
Emily
Hi Emily,
Just grab the sky and drag with the left mouse button. Check out the second video here: http://cesiumjs.org/2014/08/01/Cesium-version-1.0-released/
Patrick
Is there anyway to set a specific position though without dragging the mouse? So that when the code runs it immediately starts there?
The following has worked for me, should work in sandcastle
camera at long, lat elevation -123.139,49.315,2
looking 60 degrees to the west , 15 degrees above horizon,
I need to use the flyto with a longer duration and the setTimeout to let terrain info load up.
directly setting scene.camera.position , scene.camera.heading, scene.camera.tilt
results in the scene rolled sideways , there is probably an easier way to do this, any comments welcome
var viewer = new Cesium.Viewer(‘cesiumContainer’);
var scene = viewer.scene;
viewer.terrainProvider = new Cesium.CesiumTerrainProvider({
url : '//cesiumjs.org/stk-terrain/tilesets/world/tiles'
});
scene.camera.flyTo({
destination: new Cesium.Cartesian3.fromDegrees(-123.139,49.315,2),
duration: 10,
complete:
function(){
setTimeout( function(){
scene.camera.position = new Cesium.Cartesian3.fromDegrees(-123.139,49.315,2);
scene.camera.heading =( 60 * Math.PI / 180);
scene.camera.tilt =( -15 * Math.PI / 180);
},2000);
}
});
If you search camera.js for heading and tilt you’ll find results, but not for roll. There should be a roll setting as well. Although you can alternatively set the orientation vectors camera.direction, camera.right, camera.up vectors as well, these are Cartesian based so you’ll have to consider where on Earth you are. Up in the Cartesian system is in the direction of Earth center to Earth north pole. Cartesian up is away from gravity on North pole, but is toward gravity in Antartica.
Starting in Cesium 1.6 you can use
camera.setView({
position : Cesium.Cartesian3.fromDegrees(latitude, longitude),
pitch : Cesium.Math.PI_OVER_TWO
});
For details see https://groups.google.com/forum/#!topic/cesium-dev/2-Fn_8yeurY.
Dan