【发布时间】:2021-11-24 13:31:17
【问题描述】:
我想创建一个可以在调用方法后加载 gltf 的扩展。我正在根据这个blog 使用最新的threejs 模块。但是遇到了错误。
这是我的代码。
const gltfLoader = new GLTFLoader();
let example = new THREE.Object3D();
gltfLoader.load(
"https://threejsfundamentals.org/threejs/resources/models/cartoon_lowpoly_small_city_free_pack/scene.gltf",
(gltf) => {
example = gltf.scene;
console.log(example);
if (!this.viewer.overlays.hasScene("gltf")) {
this.viewer.overlays.addScene("gltf");
}
this.viewer.overlays.addMesh(example, "gltf");
}
);
【问题讨论】: