3dtiles贴地

从网上下载的大雁塔和文庙的3dtiles。一个在天空,一个在地下。。

加载模型时设置clamptoground无效。。

    var height = 81.5;  //根据地形设置调整高度 大雁塔:-420
    tileset.readyPromise.then(function(argument) {
      //贴地显示
      var cartographic = Cesium.Cartographic.fromCartesian(tileset.boundingSphere.center);
      var surface = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, cartographic.height);
      var offset = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, cartographic.height + height);
      var translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3());
      tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation);
    })

参考1:https://www.cnblogs.com/HandyLi/p/11113030.html

参考2:https://blog.csdn.net/caozl1132/article/details/111549414

参考3:https://www.cnblogs.com/huqi-code/p/8288239.html  https://www.jianshu.com/p/bc0c3f84226c

    //修改高度【独立方法】
    // setHeight(height) {
    //   let center = Cesium.Cartographic.fromCartesian(this.tileset.boundingSphere.center);
    //   let surface = Cesium.Cartesian3.fromRadians(center.longitude, center.latitude, center.height);
    //   let offset = Cesium.Cartesian3.fromRadians(
    //     center.longitude,
    //     center.latitude,
    //     center.height + height
    //   );
    //   let translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3());
    //   this.tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation);
    // }

 

上一篇:联网玩具CloudPets 泰迪熊泄漏数百万语音信息


下一篇:4G VoLTE存在漏洞可导致手机用户地理位置和其它个人信息泄露