I’ve been working on a project that compiles FBX files into Unity Asset Bundles which currently works fine. I use three.js to display these FBX files on the browser, it works fine most of the time (We use MODO to export / design our models), I have noticed that some models will just not load and will display an this error on the console (Using Chrome, I get a similar error in FireFox):
Uncaught TypeError: Cannot read property ‘traverse’ of undefined
In this case my 3D model was never loaded from the FBX file, yet I am unsure why.
P.D. I edited the FBXLoader to look for my textures on a different folder (That works fine, and that’s the only thing I have modified) so FBXLoader.js and DexFBXLoader.js are almost the same thing, except for that little variation.
parseImages() uses videoNode.Filename to access the path of the image. The problem is that videoNode only has a FileName property for your FBX file. This could be a problem of the loader (/cc @looeee).
@xedret Apart from that, you should always use the latest version of three.js and FBXLoader. In general, we are not supporting older versions of three.js. However, even the latest version of the loader uses videoNode.Filename.
Hey @Mugen87 thanks a lot, I for some reason my debugger doesn’t get to that point, I will try to fix that myself now that I have a hint on what’s happening (Will also update my files).
Should I submit the fix to the repo?
Also, what browser were you using to get that debug info?
I am having a similar issue with some of my fbx files. Here’s the error I am getting on the error callback from the load function:
FBXLoader: FBX binary version: 7300
TypeError: Cannot read property 'id' of undefined
at parseAnimationCurveNodes (index.js:2181)
at parseAnimations (index.js:2145)
at addAnimations (index.js:2358)
at parseScene (index.js:1516)
at FBXLoader.parse (index.js:100)
at Object.onLoad (index.js:45)
at XMLHttpRequest.<anonymous> (three.module.js:34809)
I noticed that my fbx was loading fine but nothing was showing up. I think it’s because my fbx had no animation. I removed the line in the example file, webgl_loader_fbx.html, and it worked after that. It won’t play animation now but it should load static files just fine. There’s a better solution but this is the problem.
// model
var loader = new FBXLoader();
loader.load( 'D9_printcab_1.fbx', function ( object ) {
//mixer = new THREE.AnimationMixer( object ); // Comment this out
//var action = mixer.clipAction( object.animations[ 0 ] ); // comment this out
//action.play(); // comment this out
object.traverse( function ( child ) {
if ( child.isMesh ) {
child.castShadow = true;
child.receiveShadow = true;
}
} );
scene.add( object );
} );
@xedret. The discussion was very interesting. My problem is the part you’ve already solved at the first place! You have mentioned that you were successful in editing the FBXLoader in order to look into your texture path, rather than the current folder as the one the .JS file is located in. Great! Could you help me with your FBXloader modification please? I couldn’t figure out which part should be changed. I have already downloaded the one which is included in the r117. I’m pretty sure it should not be that different from the version you’ve already modified.
And everybody, if there is some other way to make FBXLoader check the texture folder, it’d be greatly appreciated if you let me know about it. FYI, this is the loader’s common reaction to almost any file it’s been given.
I have the same issue like you when loading FBX file into the scene in ThreeJS.
TypeError: Cannot read property ‘attributes’ of undefined
at FBXTreeParser.createMesh (FBXLoader.js:1250)
at FBXTreeParser.parseModels (FBXLoader.js:919)
at FBXTreeParser.parseScene (FBXLoader.js:832)
at FBXTreeParser.parse (FBXLoader.js:175)
at FBXLoader.parse (FBXLoader.js:147)
at Object.onLoad (FBXLoader.js:95)
at XMLHttpRequest. (three.module.js:36508)