當前位置:網站首頁>Cesium獲取當前相機視角

Cesium獲取當前相機視角

2022-01-27 01:40:55 ONEGISER(ZPC)

import {
     Cartographic, Viewer, Math as CesiumMath, Cartesian2 } from "cesium"; 
const heading = CesiumMath.toDegrees(viewer.camera.heading)
const pitch = CesiumMath.toDegrees(viewer.camera.pitch)
const roll = CesiumMath.toDegrees(viewer.camera.roll)
const cartographic = viewer.camera.positionCartographic
const {
     height, longitude, latitude } = cartographic
       
const result={
     height, longitude: CesiumMath.toDegrees(longitude), latitude: CesiumMath.toDegrees(latitude), heading, pitch, roll }

           console.log(
             `heading: ${
      result.heading}, pitch: ${
      result.pitch}, roll: ${
      result.roll}, x:${
      result.longitude}, y:${
      result.latitude}, z:${
      result.height}`)

版權聲明
本文為[ONEGISER(ZPC)]所創,轉載請帶上原文鏈接,感謝
https://cht.chowdera.com/2022/01/202201270140551960.html

隨機推薦