I have a model that I’m loading as .glb.
I’ve set up the camera, scene etc and the model displays correctly with no errors. I’m trying to animate the bones in the model but when I try to access them I get an undefined error. I’ve re-imported the model into Blender to double check that the bones are in the exported file and they are, options on save are set to include armature etc.
In Blender the bones structure looks like this:
I am trying to target the ‘Brain’ component like this:
const brainBone = scene.getObjectByName("Brain");
console.log(brainBone);
The log returns undefined.
I also tried:
scene.traverse(function (object) {
console.log(object.name);
});
and inspected the object but there’s no reference to armature in there.
Current imports:
import * as THREE from 'three';
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
Am I Missing something obvious here?
Do I have to import a Three.js addon to load the armature with the model?