javascript - Three.js:TypeError:无法读取未定义的属性“0”
问题描述
我是 Three.js 的新手,并不完全熟悉。在我的新项目中,我正在尝试使用GLTFLoader()
. 但它给了我一个我不明白的错误。这是我第一次遇到这个错误。
这是错误:
TypeError: Cannot read property '0' of undefined
at Application.js:41
at GLTFLoader.js:147
at GLTFLoader.js:1639
但是当我将它导入到https://gltf.insimo.com时,它显示得非常好。所以我的这个错误。这就是我加载 gltf 的方式:
this.gltfLoader.load('/corolla.gltf', (_corolla) => {
this.resources.corolla = _corolla.children[0]
// Set environment
this.setEnvironment()
}, (xhr) => {
console.log(Math.round(xhr.loaded / xhr.total * 100) + '% loaded');
}, (error) => {
console.log('An error happened: ', error);
});
解决方案
推荐阅读
- google-apps-script - 根据单元格值隐藏谷歌工作表中的多行 - 性能问题
- git - Adding large files to docker during build
- rest - grails v3.3.9:如何将脚手架视图与其他 API 分开
- monitoring - Key health metrics for Apache Flink
- php - 需要一个正则表达式,只在 img 的 src 中留下 fileName
- openvino - How can I run samples from openVINO
- ruby-on-rails - 显示帖子的所有评论,但只显示一次用户名
- sql - How to get records with maximum Sr in SQL query
- angular - Angular swPush notificationonclick 在开发模式下工作,但在生产模式下不工作
- python - python临时文件读写