Cesium 模型旋转


     // 创建一个航向角、俯仰角和横滚角对象
var heading = Cesium.Math.toRadians(90); // 航向角,90度表示正东
var pitch = Cesium.Math.toRadians(0);   // 俯仰角,0度表示水平
var roll = Cesium.Math.toRadians(0);    // 横滚角,0度表示平衡




 let hpr = new Cesium.Matrix3(); // new Cesium.HeadingPitchRoll(heading, pitch, roll) // heading围绕负z轴的旋转。pitch是围绕负y轴的旋转。Roll是围绕正x轴的旋转 笛卡尔空间直角坐标系向上为z 向右为Y 向相机为x // let hprObj = new Cesium.HeadingPitchRoll(-0.18*Math.PI, 0, 0) //(z,y,x) 2021/11/24 原
      let hprObj = new Cesium.HeadingPitchRoll(0, 0, 100); //(z,y,x) //  Cesium.Matrix3.fromHeadingPitchRoll (headingPitchRoll,result)

      hpr = Cesium.Matrix3.fromHeadingPitchRoll(hprObj, hpr); // 2、平移 // 2.3储存平移的结果
      let modelMatrix = Cesium.Matrix4.multiplyByTranslation(
        // 2.1从以度为单位的经度和纬度值返回Cartesian3位置
        // 2.2计算4x4变换矩阵
        Cesium.Transforms.eastNorthUpToFixedFrame(
          Cesium.Cartesian3.fromDegrees(112.555, 38.55, 0)
        ),
        new Cesium.Cartesian3(),
        new Cesium.Matrix4()
      ); /// 3、应用旋转 // Cesium.Matrix4.multiplyByMatrix3 (矩阵,旋转,结果) // Cesium.Matrix4.multiplyByMatrix3(modelMatrix, hpr, modelMatrix)
      Cesium.Matrix4.multiplyByMatrix3(modelMatrix, hpr, modelMatrix);
      tileset._root.transform = modelMatrix;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小白学过的代码

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值