Hello everyone, when you make a concatenation of animations of a .glb file, it fails in the connections between them. The idea is to have 3 animations, 1 input, another output, and 1 in the middle that is repeated, performed the glb in blender. Mainly, the scheme is as follows:
clip1: Frame (1.80)
clip2: Frame (80,200)
clip3: Frame (200,280)
Where frame 1 = 280, 80 = 200.
This is repeated constantly
the code is:
mixer = new THREE.AnimationMixer( mesh );
var anim = gltf.animations;
var start = THREE.AnimationClip.findByName( anim, 'Entrada' );
var repeat = THREE.AnimationClip.findByName( anim, 'Repeticion' );
var end = THREE.AnimationClip.findByName( anim, 'Salida' );
if (anim.length>0){
var contador = 1;
var actionstart = mixer.clipAction( start );
var actionrepeat = mixer.clipAction( repeat );
var actionend = mixer.clipAction( end );
actionstart.repetitions = 1;
actionend.repetitions = 1;
actionstart.play();
actionrepeat.play();
actionend.play();
mixer.addEventListener( 'finished', ( event ) => {
console.log('Finished animation:' + contador,event)
if(contador == 1){
actionrepeat.reset();
actionstart.crossFadeTo(actionrepeat, 0);
actionrepeat.repetitions = repe;
}
if(contador == 2){
actionend.reset();
actionrepeat.crossFadeTo(actionend, 0);
}
if(contador == 3){
actionstart.reset();
actionend.crossFadeTo(actionstart, 0);
contador = 0;
}
contador+=1;
});
};
});
The fault seems to be that the animation is from frame 1 and when making .reset (), frame 0 is rendered first, therefore an image appears with the .glb in the position without animation and produces a jump in the image, It is not continuous between the different clips.
I hope I have explained myself, and if you could help me with any solution it would be helpful.
Regards, and thank you very much