Hi, I’m trying to setup an animated GLTF model, but it seems that the animations array of the model is empty at first I thought it was an issue with my model but after I tried the Xbot model from three js sources it seems that the animations array is still empty.
As it run in the example I wonder what I’m doing wrong.
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader";
const loader = new GLTFLoader();
loader.load("Xbot.glb", (gltf) => {
console.log(gltf.animations); // EMPTY
});
GLTFLoader returns animations attached to the root gltf.animations
object. If that array is empty, the model does not contain any animation.
In the screenshot you show several other empty animations: []
arrays, attached to some THREE.Group and THREE.Object3D instances. GLTFLoader does not use those arrays, and they will always be empty when loading a glTF file. So you only need to check the root gltf.animations
list.
2 Likes
Oh my god Im so stupid, okay I get it. Thanks.
For some reason I’ve setted my loader to return the .scene object of the gltf but animations are in the root of the gltf.
Thanks a lot.
2 Likes