如何在物体周围移动相机以从各个角度观察物体?

时间:2019-06-28 19:57:32

标签: camera cesium

铯摄像机如何在圆形路径中的对象周围移动?

1 个答案:

答案 0 :(得分:0)

假设您想要类似于直升机圈子的东西...可以在每个时钟滴答处通过“ lookAt”来完成。

let heading = 0; //or any starting angle in radians
let rotation = -1; //counter-clockwise; +1 would be clockwise
let centre = new Cesium.Cartesian3.fromDegrees(longitude, latitude);
let elevation = 100; // 100 meters
let pitch = -0.7854; //looking down at 45 degrees

const SMOOTHNESS = 600; //it would make one full circle in roughly 600 frames

viewer.clock.onTick.addEventListener(() => {
    heading += rotation * Math.PI / SMOOTHNESS;
    viewer.camera.lookAt(centre, new Cesium.HeadingPitchRange(heading, pitch, elevation));
});