视角设置
javascript
viewer.camera.setView({
destination:Cesium.Cartesian3.fromDegrees(118.0658439,24.5915414,2500),//目的地
orientation:{
heading:Cesium.Math.toDegrees(0),//左右平移0
pitch:Cesium.Math.toDegrees(90),//上下点头90
roll:Cesium.Math.toDegrees(0),//歪头0
}
})
相机飞行
javascript
setTimeout(() => {
viewer.camera.flyTo({
destination: position,
orientation: {//和上面一样三个参数
// heading: Cesium.Math.toDegrees(0),//左右平移0
// pitch: Cesium.Math.toDegrees(0),//上下点头90
// roll: Cesium.Math.toDegrees(0),//歪头0
},
duration:3//飞行时间
});
}, 3000);
lookat
javascript
const position3 = Cesium.Cartesian3.fromDegrees(118.0658439, 24.5915414);
viewer.camera.lookAt(
position3, //位置锁定
new Cesium.HeadingPitchRange(
Cesium.Math.toRadians(0),
Cesium.Math.toRadians(-90),
20000
)
);
对于entities实体:相机锁定该实体
javascript
viewer.zoomTo(point)//地图跳转