How to play collada model animation if the array clip is not really defined

Hy everyone, i’m am happy to find the community active and give quick response unlike stack websites
My question is:
How can i play a model animation of a collada model if the array of the animation clip is not really known: Is it possible to have something like the starting frame and the ending frame of the animation?

How do you load your collada files? With ColladaLoader or ColladaLoader2? Besides, i’m not sure i’ve understood your problem^^. When you load an animated model with ColladaLoader2, the corresponding animation clips should always be located in the result object of the loader e.g.

loader.load( './model.dae', function ( collada ) {

   var animations = collada.animations;
   var avatar = collada.scene;

   mixer = new THREE.AnimationMixer( avatar ); // create global mixer
   mixer.clipAction( animations[ 0 ] ).play(); // play first animation clip

   scene.add( avatar );

} );

i mean what if a single animation clip consists of several different animations, how can i sort the animations to a new clip?

I think it’s not a good practice to manipulate animation clips in this way. Make sure, your 3D authoring software exports animations in a correct way. Each animation (like “idle”, “walk” or “run”) should be a separate clip.

1 Like

@Mugen87 unfortunately that’s not always possible - for example fbx format only supports a single animation and the recommended way of exporting multiple animations there is a single timeline, frames 0 to 29 walk, 30 to 59 jump etc.

Additionally many, or perhaps even most commercially available models have animations stored this way - so the question is a bit off topic here, but it is a valid question.

2 Likes

I see. I’m just surprised that this questions comes up only now. Shouldn’t more people have the same problem?

Yes - although I’m going to have to tackle it in the next couple of days as it turns out :laughing:

Wish you luck​:+1::+1: @looeee

I agree @Mugen87