首页 / 浏览问题 / 三维GIS / 问题详情
viewer.camera.flyTo以倾斜视角飞向点位的时候,会偏移出去很多
1EXP 2022年09月30日
以倾斜视角飞向一个点位的时候,会偏移出点位的原始位置

2 个回答

看看代码
330EXP 2022年09月30日
export function flyTo(x, y, z, heading, pitch) {

  console.log(x, y, z, heading, pitch);

  const point = new Cesium.Cartesian3(x, y, z); //平面坐标

  const positionTr = viewer.scene.camera._projection.unproject(point); //平面坐标值转弧度

  const longitude = Cesium.Math.toDegrees(positionTr.longitude); //弧度转经纬度

  const latitude = Cesium.Math.toDegrees(positionTr.latitude);

  viewer.camera.flyTo({

    //经度、纬度、高度

    destination: new Cesium.Cartesian3.fromDegrees(longitude, latitude, z),

    orientation: {

      //水平偏角,默认正北 0

      heading,

      //俯视角,默认-90

      pitch,

      //旋转角

      roll:0.0

    },

    //过度时间

    duration: 1,

  });

}
你好,通过这种方式如果俯视角不是默认的-90的话,目标不会出现在视线范围内

您好,

我这边测了一下有倾斜视角的定位是没有问题的哈

您那边可以检查一下是否坐标转换时出了问题,可以参考我们坐标转换相关的博客参考一下:https://blog.csdn.net/supermapsupport/article/details/89519310

希望可以帮助到您。

795EXP 2022年09月30日
...