Play a sequence of animations

Hey there,
I’ve got a character with 20 animations and I want him to play three of those animations in a sequence like when I press a button.

First he should play and finish animation one, then two and then the last one.

Is there any functionality in the mixer for this or do I have to script it manually?

Kind regards :slight_smile:

Reminds me at the following stackoverflow thread:

AnimationMixer provides no API to organize animations in a chain so multiple animations are sequentially played. However, it’s not hard to build something similar on top of the existing API.

If you add an event listener for the finished event to your instance of AnimationMixer, you will automatically be notified when an AnimationAction has finished its playback. This is the exact point to start with the next animation.

3 Likes

That’s awesome and it works like a charm.

I actually noticed a different bug and maybe you can help out once again.

When i start playing a new animation my blendshapes reset to 0. They are not keyed in the animation.

Is this default or can I toggle it on/off?

Should’nt the blendshapes be uneffected by any animation?

Greets

Could you share a demo, or your code? Animation can control blendshapes, but whether that’s the cause of what you’re seeing I don’t know.

1 Like

Hey,
is there a way to turn that off?

Greets

When i start playing a new animation my blendshapes reset to 0. They are not keyed in the animation.

How do you know they aren’t keyed in the animation? That’s the only way I’d expect blendshapes to be affected, unless it’s something in your application’s code… Either way, you’ll have to provide more information here for us to know what’s going on.

Hey,
i just found the issue. The mixer resets all blendshapes when no actions is played.

Found a workaround and now it’s working fine.

Greets

Would be curious what you found? I don’t see any references to morph targets in AnimationMixer.js.