如何使用三个 js 加载 gltf 文件


var manager = new THREE.LoadingManager();
const loader = new THREE.GLTFLoader(manager);
// A reusable function to set up the models. We're passing in a position parameter
// Load a glTF resource
**line90**      loader.load(
// resource URL
'static/ElmTree.gltf',
// called when the resource is loaded
function ( gltf ) {
enter code here
scene.add( gltf.scene );
});

嗨,我正在学习三个.js并且通过以下 discoverthree.js 文件加载文件外部 gltf 文件时出错。我从谷歌聚下载了一个文件,但不确定我做错了什么。我在下面收到错误,并且也尝试了文档中所述的加载管理器。

我正在使用 Flask 运行应用程序,如果我需要添加更多信息以了解问题,请告诉我。 提前谢谢你:)

three.js:49037 THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.
get @ three.js:49037
(anonymous) @ GLTFLoader.js:2161
Promise.then (async)
THREE.GLTFLoader.GLTFParser.loadTexture @ GLTFLoader.js:2157
THREE.GLTFLoader.GLTFParser.getDependency @ GLTFLoader.js:1829
THREE.GLTFLoader.GLTFParser.assignTexture @ GLTFLoader.js:2223
THREE.GLTFLoader.GLTFParser.loadMaterial @ GLTFLoader.js:2308
THREE.GLTFLoader.GLTFParser.getDependency @ GLTFLoader.js:1825
THREE.GLTFLoader.GLTFParser.loadMesh @ GLTFLoader.js:2675
THREE.GLTFLoader.GLTFParser.getDependency @ GLTFLoader.js:1809
(anonymous) @ GLTFLoader.js:3146
THREE.GLTFLoader.GLTFParser.loadNode @ GLTFLoader.js:3210
THREE.GLTFLoader.GLTFParser.getDependency @ GLTFLoader.js:1805
buildNodeHierachy @ GLTFLoader.js:3269
(anonymous) @ GLTFLoader.js:3351
Promise.then (async)
buildNodeHierachy @ GLTFLoader.js:3336
(anonymous) @ GLTFLoader.js:3351
Promise.then (async)
buildNodeHierachy @ GLTFLoader.js:3336
(anonymous) @ GLTFLoader.js:3351
Promise.then (async)
buildNodeHierachy @ GLTFLoader.js:3336
loadScene @ GLTFLoader.js:3383
THREE.GLTFLoader.GLTFParser.getDependency @ GLTFLoader.js:1801
(anonymous) @ GLTFLoader.js:1877
THREE.GLTFLoader.GLTFParser.getDependencies @ GLTFLoader.js:1875
THREE.GLTFLoader.GLTFParser.getMultiDependencies @ GLTFLoader.js:1902
THREE.GLTFLoader.GLTFParser.parse @ GLTFLoader.js:1703
parse @ GLTFLoader.js:221
(anonymous) @ GLTFLoader.js:75
(anonymous) @ three.js:36378
load (async)
load @ three.js:36356
load @ GLTFLoader.js:71
loadModels @ index.js:90
init @ index.js:21
(anonymous) @ index.js:142

代码中的GLTFLoaderthree.js似乎来自不同的版本。您始终必须确保库核心和示例文件(如GLTFLoaderOrbitControls(的版本匹配。

相关内容

  • 没有找到相关文章

最新更新