Hi,
Previously when I imported FBX models and try to play it’s animations, I simply had to loop through it’s animation array like this:
setModelAnimation(object, clipName, model_repeat) {
this.mixer = new this.context.three.AnimationMixer(object);
this.clipAction = this.mixer.clipAction(this.context.three.AnimationClip.findByName(this.findAnimations(object), clipName));
this.clipAction.play();
if (model_repeat == false) {
this.clipAction.clampWhenFinished = true;
this.clipAction.repetitions = false;
}
}
findAnimations(object) {
const animations = new Array();
object.traverse(obj => {
if (obj.animations) {
obj.animations.forEach(anim => animations.push(anim));
}
});
return animations;
}
However now when I import the same model but in GLB format, the animation array is empty for some reason. But I’m able to play this model’s animations here:
The GLB and FBX model can be downloaded here:
Can someone please tell me how can I play GLB model animations in Three JS if the animations array is empty?
Thanks!