Alpha gives you a pose between the pose from track1 and the pose from track2. If your animations are out of phase such that one wants the leg in front and the other wants the leg behind, then 50% of the way between those poses is the leg nearly straight up and down. This is the sort of stuttering you see.
When the animations have different durations, their phase will vary over time. However, this could also happen when the animations are the same durations, depending on when the legs are animated in front/behind and also when the animations were started.
I think you could solve this by adjusting TrackEntry timeScale
so the animations match. Maybe start by setting the run animation so it plays at the speed of the walk animation. Then increase the run speed based on the TrackEntry alpha, between walk speed (0 alpha) and full run speed (100% alpha). The walk speed would also change, from normal walk speed (0 alpha) to full run speed (100% alpha).
This way the animations always match as you transition from walk to run. The animations don't have to have the same duration, but the movements do need to match when run is played at the speed that matches walk.
You may find this a bit weird because it's different from the more common weighted animation blending. There are some advantages, eg it allows layering animations. You can do weighted animation blending if you prefer. For that you use additive animation blending by setting TrackEntry mixBlend
to MixBlend add
. It would work like this:
-
First you need to reset everything from last frame back to some reasonable value. This can be done with Skeleton setToSetupPose
or by applying an animation on a lower track than the tracks using MixBlend add
.
-
Next you play walk
on a track and run
on a different track. Set MixBlend add
on both.
-
Set TrackEntry alpha
to the weights you want so they sum to 1.
For example, 0.25 walk and 0.75 run. This adds 25% of the walk pose and 75% of the run pose to the pose established by step 1. By that I mean 25% of the values that are the distance from the setup pose to the pose from the walk animation. You can mix any number of animations this way, eg 0.3, 0.2, 0.5 sums to 1. You can also exceed the sum of 1, but will distort the poses.
If you don't do step 1, then pose values from last frame remain. You add new pose values to that each frame and in just a few frames your skeleton has exploded!
I expect weighted animation blending is what Mechanim is doing. I doubt Mechanim is scaling the animations, it's just harder to notice when they are out of phase. The result can be similar to what I described above, but isn't the same. You can still have the same out of phase problem, but it may be less noticeable.