简体   繁体   English

未捕获的类型错误:无法读取未定义的属性“setCrossOrigin”

[英]Uncaught TypeError: Cannot read property 'setCrossOrigin' of undefined

I want to run .obj file and .mtl file, but when I run only .obj loader it doesnt show any problem.我想运行 .obj 文件和 .mtl 文件,但是当我只运行 .obj 加载程序时,它没有显示任何问题。 Running objloader together with mtlloader it gives me an error:将 objloader 与 mtlloader 一起运行它给了我一个错误:

MTLLoader error MTLLoader 错误

Code that I use to load .obj and .mtl files is:我用来加载 .obj 和 .mtl 文件的代码是:

 carLoad = new THREE.MTLLoader(); carLoad.load('assets/obj/audi/Audi_R8.mtl',function(materials){ materials.preload(); objLoader = new THREE.OBJLoader(); objLoader.setMaterials(materials) objLoader.load( 'assets/obj/audi/Audi_R8.obj', function ( object ) { object.position.set(-50, 0, -60); scene.add( object ); }); });

Any idea how to fix this?知道如何解决这个问题吗?

This runtime error indicates a version mismatch of your library files.此运行时错误表明您的库文件版本不匹配。 You always have to ensure that the core file ( three.js ) as well as all example files (like OBJLoader or MTLLoader ) are from the same release.您必须始终确保核心文件 ( three.js ) 以及所有示例文件(如OBJLoaderMTLLoader )来自同一版本。 Please try it with the latest version which is r115 right now.请立即尝试使用最新版本r115

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 未捕获的TypeError:无法读取未定义的属性“未定义” - Uncaught TypeError: Cannot read property 'undefined' of undefined 未捕获的TypeError:无法读取未定义的属性“数量” - Uncaught TypeError: Cannot read property 'quantity' of undefined 未捕获的TypeError:无法读取未定义的属性'fromJSON' - Uncaught TypeError: Cannot read property 'fromJSON' of undefined 未捕获的TypeError:无法读取未定义的属性“ timing” - Uncaught TypeError: Cannot read property 'timing' of undefined 未捕获的TypeError:无法读取未定义的属性'formatter' - Uncaught TypeError: Cannot read property 'formatter' of undefined Uncaught TypeError:无法读取未定义的属性“ stopVideo” - Uncaught TypeError: Cannot read property 'stopVideo' of undefined 未捕获的TypeError:无法读取未定义的属性'NaN' - Uncaught TypeError: Cannot read property 'NaN' of undefined 未捕获的TypeError:无法读取未定义的属性'getAttribute' - Uncaught TypeError: Cannot read property 'getAttribute' of undefined 未捕获的TypeError:无法读取未定义的属性“地理编码” - Uncaught TypeError: Cannot read property 'geocode' of undefined 未捕获的TypeError:无法读取未定义的属性“时间戳” - Uncaught TypeError: Cannot read property 'timestamp' of undefined
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM