Reputation: 11
I'm new to three.js and I was following along a tutorial on loading GLTF Models using Three.js. I wanted to practice by using the FBX loader to import and animate models from Mixamo.
The tutorial used CDNs for the three.min.js and GLTFLoader files. I tried doing the same for the FBXLoader. However, I keep getting errors calling the FBXLoader from my main.js file
In my HTML I have:
In my main.js I've tried calling it like so:
const loader = new THREE.FBXLoader();
and
const loader = new FBXLoader();
then get the following respective errors
Uncaught TypeError: THREE.FBXLoader is not a constructor
Uncaught ReferenceError: FBXLoader is not defined
I've messed around with it quite a bit, and tried removing the type "module" and changing "jsm" to "js" with no luck either. (Plus I also encounter a deprecation warning when I do that). I don't have the best understanding of importing plugins from three.js so any clarification would help.
Also, I see that GLTF is the preferred format for Three.js, should I convert my FBX model and animations from Mixamo to GLTF using blender?
Thank you
Upvotes: 1
Views: 1240
Reputation: 136
Did you try loading the FBXLoader first via script- tag in your html as it must be before instantiating it ? If not, load the .js- version.
Upvotes: 1