Open Thundros opened 4 years ago
Hi @takahirox ! So I'm trying to load a 3d model & mtl file located inside of a zip file. The zip loading works fine. but when I do this
var manager = new THREE.LoadingManager ( ); var url = 'res/game/assets/models/OBJ/female/female.zip'; new Promise ( function( resolve, reject ) { if ( url.match( /\.zip$/ ) ) { new THREE.ZipLoader ( ).load ( url ).then ( function ( zip ) { manager.setURLModifier ( zip.urlResolver ); resolve ( zip.find ( /\.(obj|mtl)$/i ) [ 0 ] ); } ); } else { resolve ( url ); } } ).then ( function ( file ) { new THREE.GLTFLoader ( manager ).load ( file, function ( gltf ) { var object = gltf.scene; object.traverse ( function ( obj ) { if ( obj.material && obj.material.isMeshStandardMaterial ) { obj.material.envMap = envMap; } } ); scene.add ( object ); } ); } ).then ( function ( file ) { new THREE.OBJLoader ( manager ).load ( file, function ( obj ) { var object = obj.scene; object.traverse ( function ( obj ) { if ( obj.material && obj.material.isMeshStandardMaterial ) { obj.material.envMap = envMap; } } ); scene.add ( object ); } ); } );
I get a whole bunch of warnings such as :
OBJLoader.js:706 THREE.OBJLoader: Unexpected line: "<script src="res/game/src/js/loaders/OBJLoader.js"></script>"
and I get 1 error :
TypeError: Cannot read property 'traverse' of undefined at main.js:190 at Object.onLoad (OBJLoader.js:445) at XMLHttpRequest.<anonymous> (three.js:36863)
How can I fix this?
Thank You! <3
@takahirox : Hello?
Hi @takahirox ! So I'm trying to load a 3d model & mtl file located inside of a zip file. The zip loading works fine. but when I do this
I get a whole bunch of warnings such as :
and I get 1 error :
How can I fix this?
Thank You! <3