Use animation weights to smoothly blend between multiple animations simultaneously. This is essential for creating natural character movement transitions:

// Enable animation blending on the skeleton
scene.animationPropertiesOverride = new BABYLON.AnimationPropertiesOverride();
scene.animationPropertiesOverride.enableBlending = true;
scene.animationPropertiesOverride.blendingSpeed = 0.05;

// Control animation weights for blending
const idleAnim = animationGroups[0];
const walkAnim = animationGroups[1];

idleAnim.play(true);
walkAnim.play(true);

// Blend from idle to walk
idleAnim.setWeightForAllAnimatables(1.0);
walkAnim.setWeightForAllAnimatables(0.0);

// Gradually transition
let blendFactor = 0;
scene.onBeforeRenderObservable.add(() => {
    if (isWalking && blendFactor < 1) {
        blendFactor = Math.min(1, blendFactor + 0.02);
        idleAnim.setWeightForAllAnimatables(1 - blendFactor);
        walkAnim.setWeightForAllAnimatables(blendFactor);
    }
});