Prior to version 1.107
//倾斜摄影
const tileset = new Cesium.Cesium3DTileset({
url: "http://你的地址/tileset.json",
});
viewer.scene.primitives.add(tileset);
tileset.readyPromise.then(function (tileset) {
viewer.zoomTo(tileset);
})
In the version update in July 2023, the above-mentioned writing method can no longer be used. It is said that the version update of cesium is too fast. A lot of things have been changed in July. Pay attention to the change news on the official website.
After version 1.107
try {
const tileset = await Cesium.Cesium3DTileset.fromUrl(
"http://你的地址/tileset.json"
);
scene.primitives.add(tileset);
viewer.zoomTo(tileset);
} catch (error) {
console.error(`Error creating tileset: ${
error}`);
}