Lite: Animation weight and crossFadeAnimationGroups are not working

There are 3 issues in the following playground with Nightly (latest source):

  1. setAnimationWeight() has no effect (line 71)
  2. crossFadeAnimationGroups() has no effect on pointerdown (line 81)
  3. animation speed is doubled when added to a AnimationManager (line 67, not sure if it is a bug or intended)

When testing with 1.8.0:

  1. animation speed and initial animation weight seems to be correct when added to a AnimationManager
  2. crossFadeAnimationGroups() will stop the animations
  3. center & right models always give T-pose, with & without adding to a AnimationManager

Expected result:

  1. Initial blended with walk and run animations with weight 0.5.
  2. On pointerdown, swap between walk / run animation.

cc @ryantrem as he worked on animations lately

Looking…

Fix under way, should be merged soon: fix(animation): stop double-driving glTF groups owned by an AnimationManager by ryantrem · Pull Request #389 · BabylonJS/Babylon-Lite · GitHub

Thanks for the PR, the issues listed above are indeed resolved.

I see the crossFadeAnimationGroups() are always setting the animation weight at 0 or 1, never in between. Looks like durationMs passed in options is being ignored. I have checked enableAnimationBlending() is already called. Is there anything I am missing to make the blending work?

FIX 1: Start all animations - Instead of stopping animations, all animations are started with weight 0. Both animations must be playing for crossfade to work.

FIX 2: Set initial weight - Set the initial animation (walk) to weight 1 outside the loop for clarity and to ensure it works correctly.

FIX 3: Increased duration - Changed durationMs from 1 to 1000ms (1 second) so you can actually see the transition happening.

FIX 4: Proper animation management - All animations are now properly managed with correct play/stop states for crossfading.