I was able to load a static model that I exported using Blender as a .gltf file. At first, I tried .glb, but it would not load because there was a missing DRACOLoader regardless of whether I instantiated one myself or not. I rigged the model in Blender and would like to be able to access the bones and then have posing controlled by user keyboard input. However, I cannot access the rig at all in Three.js. I keep getting “cannot read property of undefined” errors. This is what I have right now regarding loading the model:
const modelLoader = new GLTFLoader();
modelLoader.load('/models/fm.gltf', (gltf) => {
let model = gltf.scene;
scene.add(model);
const mats = gltf.scene.getObjectByName('materials');
let piece = new THREE.SkinnedMesh(model, mats);
scene.add(piece);
let skelHelper = new THREE.SkeletonHelper(piece);
scene.add(skelHelper);
});
The GLTF loader is imported above this section. I have also tried just accessing the different properties and get the same error.