cesium 设置相机视角 flyTo 参数destination,orientation

效果

复制代码
  // 监听相机的改变 用来设置相机飞行到哪里
  window.viewer.camera.changed.addEventListener(function () {
    // 当相机改变时,获取相机的参数
    let camera = window.viewer.camera;
    // 获取当前摄像机的位置(经纬度)
    let cameraPosition = window.viewer.camera.position;
    let cartographic = Cesium.Cartographic.fromCartesian(cameraPosition);
    let longitude = Cesium.Math.toDegrees(cartographic.longitude);
    let latitude = Cesium.Math.toDegrees(cartographic.latitude);
    let height = cartographic.height;
    console.log("这是camera", camera);
    console.log("这是longitude", longitude);
    console.log("这是latitude", latitude);
    console.log("这是height", height);
  });

    flyCamera(objects) {
        let {
            x = 112.582590,
            y = 31.170320,
            z = 500,
            // 垂直方向
            heading = Cesium.Math.toRadians(0),
            pitch = Cesium.Math.toRadians(-90),
            roll = 0,
        } = objects || {}
        this.viewer.camera.flyTo({
            destination: Cesium.Cartesian3.fromDegrees(x, y, z),
            orientation: {
                heading,
                pitch,
                roll,
            }
        });
    }

  window.mapCeFun.flyCamera({
  //这里的xy则是上面打印的经纬度的值,z就是height的值
    x: 112.59652732156285,
    y: 31.11775227001935,
    z: 47.195746815815795,
    //这下面三个值直接用上面打印的camera.的heading,pitch,roll直接就是弧度
    heading: 0.002975580802861977,
    pitch: -0.2504325212185343,
    roll: 1.4109491353053727e-8,
  });
相关推荐
格林威8 小时前
Baumer相机如何通过YoloV8深度学习模型实现工厂自动化产线牛奶瓶盖实时装配的检测识别(C#代码UI界面版)
人工智能·深度学习·数码相机·yolo·机器学习·计算机视觉·c#
格林威1 天前
Baumer工业相机堡盟工业相机如何通过YoloV8深度学习模型实现路口车辆速度的追踪识别(C#代码UI界面版)
人工智能·深度学习·数码相机·yolo·计算机视觉·c#·视觉检测
中达瑞和-高光谱·多光谱3 天前
推扫式和凝视型高光谱相机分别采用哪些分光方式?
数码相机
爱凤的小光3 天前
图漾AGV行业常用相机使用文档
数码相机
-dzk-3 天前
【论文精读】3D Gaussian Splatting for Real-Time Radiance Field Rendering
数码相机·opencv·计算机视觉·3d·三维重建·3dgs·高斯
格林威3 天前
Baumer工业相机堡盟工业相机如何通过YoloV8深度学习模型实现各种食物的类型检测识别(C#代码UI界面版)
人工智能·深度学习·数码相机·yolo·计算机视觉
爱凤的小光3 天前
图漾相机-ROS1_SDK_ubuntu 4.X.X版本编译
linux·数码相机·ubuntu
二川bro4 天前
第二篇:Three.js核心三要素:场景、相机、渲染器
开发语言·javascript·数码相机
格林威4 天前
Baumer工业相机堡盟工业相机如何通过YoloV8深度学习模型实现道路汽车的检测识别(C#代码,UI界面版)
人工智能·深度学习·数码相机·yolo·视觉检测
半夜偷删你代码5 天前
鸿蒙中相册权限弹窗
数码相机·华为·harmonyos