irpas技术客

Cesium orientation 和 设置初始角度_zhengshaofeng1的专栏_cesium orientation

大大的周 2924

一. Cesium orientation

orientation-相机镜头对准的方法.

heading-代表镜头左右方向,正值为右,负值为左,360度和0度是一样的 pitch-代表镜头上下方向,正值为上,负值为下. roll-代表镜头左右倾斜.正值,向右倾斜,负值向左倾斜

二. 设置初始化角度

1.先用鼠标手动调整出你想要的角度

这里viewer是new出来的地图实例

打印出你调整好位置的实例的参数 console.log(viewer.scene.camera.heading); console.log(viewer.scene.camera.pitch); console.log(viewer.scene.camera.roll); console.log(viewer.scene.camera.position)

3.根据对应的参数去设置,具体设置方式如下

var initialPosition = new Cesium.Cartesian3(-2704200.415014977, 4702023.785328262, 3345501.4084866922); // 相机的位置 var orientation = { heading: 6.283185307179586, // 视角 pitch: -1.5686521559334161, roll: 0, }; var homeCameraView = { destination: initialPosition, // 相机的位置 orientation: orientation, }; viewer.scene.camera.setView(homeCameraView);


1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,会注明原创字样,如未注明都非原创,如有侵权请联系删除!;3.作者投稿可能会经我们编辑修改或补充;4.本站不提供任何储存功能只提供收集或者投稿人的网盘链接。

标签: #cesium #orientation # #正值为右 #负值为左