I am facing an issue where I am trying to add a group of birds to a scene, but only one of them is playing the animation that I loaded. I have tried using THREE.AnimationObjectGroup as mentioned in the documentation, however, I am struggling to make it work. I use the following loop to load the objects and animations.
for (var count = 0; count < 20; count++) {
loader.load("./assets/bird.gltf", function (gltf) {
//Loading and positioning the model
var bird = gltf.scene;
bird.scale.set(10, 10, 10);
bird.position.set(Math.random() * 500, Math.random() * 500, Math.random() * 500);
var flock = new THREE.AnimationObjectGroup;
flock.add(bird);
console.log(flock);
//Playing the Animation
mixer = new THREE.AnimationMixer(flock);
console.log(gltf.animations);
mixer.clipAction(gltf.animations[0]).play();
scene.add(bird);
});
}