加载 3DTileset
js
const tileset = await Cesium.Cesium3DTileset.fromUrl(config.url);
let model = await viewer.scene.primitives.add(tileset, {
disableDepthTestDistance: Number.POSITIVE_INFINITY,
});
viewer.scene.globe.depthTestAgainstTerrain = true;
// 将3d tiles离地高度抬升20米
let cartographic = Cesium.Cartographic.fromCartesian(tileset.boundingSphere.center);
let surface = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0.0);
let offset = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, -1.0);
let translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3());
tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation);
```