相机绕点飞行原理就是获取相机参数与点位置信息,添加时间监听,一直去改变相机的heading,关键代码如下:
function rotateHeading() {
// 相机的当前heading
var heading = Cesium.Math.toDegrees(camera.heading);
if(heading>=360 || heading<=-360) heading = 0;
heading = heading + 0.25;//调节转动快慢
var pitch = viewer.camera.pitch;
var distance = viewer.camera.distance;
var ellipsoid=viewer.scene.globe.ellipsoid;//获取椭球
var cartographic=ellipsoid.cartesianToCartographic(viewer.camera.position);
var lat=Cesium.Math.toDegrees(cartographic.latitude);
var lng=Cesium.Math.toDegrees(cartographic.longitude);
var distance=cartographic.height;
scene.camera.setView({
destination : Cesium.Cartesian3.fromDegrees(lng, lat, distance), // 点的坐标
orientation: {
heading : Cesium.Math.toRadians(heading),
pitch : pitch,
endTransform: Cesium.Matrix4.IDENTITY
}
});
}

 效果图如下:

 cesium相机绕点飞行-LMLPHP

-------------------------------------------------------------------------------------------------

QQ群:871934478

版权所有,转载请注明源地址           

-------------------------------------------------------------------------------------------------

05-11 21:51