代码块-修改3dtiles高度偏移

150 阅读1分钟
//修改高度
  let setHeight = (tileset, offsetHeight) => {
    let center = Cesium.Cartographic.fromCartesian(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 + offsetHeight);
    let translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3());
    tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation);
  };