Advice: Should I build a custom animation mixer, or chop up Animation Clips?

Hi! I want to combine/layer multiple animation clips that control different parts of a skeleton. For example, I have a “idle sitting” animation clip that controls the full body (has tracks for all bones), then I have another animation clip “wave hand” that only animates bones for the top half of the body. Then I have other animation clips for “smile” and “frown” for blend shapes (does not touch bones).

Using the standard mixer, I can combine “idle sitting” and “smile” both with weights of 1. It sets the bones and blend shapes for a nice combined result, because the animation clip tracks do not overlap.

My problem is when I want to combine the “wave hand” upper body animation clip to the “idle sitting” animation clip. If I put both at weight one, it sums the sitting bone rotations with the hand wave rotations. Not a good look! If I cross blend from one to the other (fadeIn() and faceOut()), the sitting for legs etc goes away.

So it feels like I have two possible strategies:

  • Chop up my animation clips. E.g. have separate “idle sitting upper body” and “idle sitting lower body” animation clips. I can then keep the lower body at full strength and cross fade the upper body clips.

  • Build a custom animation mixer that only applies weights if bone rotations are overridden.

The first option scares me because I have animation clips for just hands, for upper body, for the head - I have to carefully plan out how to splice up all my animation clips. (Or do it at runtime - load up full animation clip then delete tracks from it to break them up as needed by analyzing which bone combinations are used by different animation clips.)

[Update: Hmmm, maybe I can also flesh out the partial clips with copies of tracks from the full clips.]

The second option scares me because I have to rebuild the animation mixer.

I was wondering if anyone had advice for which was likely to be less painful, or if there was a better solution?

Chop up the clips. 100%

They want to be edited/customized. There are ways to export partial animations directly from the modeller too, but in cases where that’s a pain, you can chop them up at runtime.
Trying to customize the AnimationMixer will probably be a World Of Pain.

1 Like