Issue with Disappearing Model When Cloning Animation Group for Additive Blending

I’m encountering a problem where my model disappears when I attempt to clone an animation group for additive blending. I used the following line in my PlayGround: https://playground.babylonjs.com/#6I67BL#507

BABYLON.AnimationGroup.MakeAnimationAdditive(scene.animationGroups.find(a => a.name === 'walk'), {cloneOriginalAnimationGroup:true})

The model vanishes as shown in the attached video. Could this be a bug, or am I missing something?

Do you need to update the walkParam.anim member after cloning the animation?

Like in https://playground.babylonjs.com/#6I67BL#510?

I saw this in Pokemon!

2 Likes

The problem is that I can not clone the AnimationGroup (I set cloneOriginalAnimationGroup to true) which still affects the original animation group somehow. What do you think @Evgeni_Popov?

Additive animations are added to an existing regular (ie. not additive) animation. If there’s no regular animation playing, animation will be broken.

Think of additive animations as: regularAnim += additiveAnim;

If there’s no regular animation running, regularAnim is 0 and you end up with only additiveAnim as the result, which is wrong.

In the original PG, you either have idle, walk or run animation playing, which are the regular (not additive) animations. Then, thanks to the slide bars, you can make some additive animations come into play (sad, sneak, … animations).

In your PG, because you convert the walk animation to additive, you don’t have any regular animation playing anymore when you click on “Walk”, hence the broken animation.

I see your point. But the thing is I can not clone an AnimationGroup that I’d like to run as a regular animation, sometimes use as an additive animation. For example this code still breaks the walk anim;
When I clone some object, and apply some changes on cloned one, I’d expect that original one should be fine.

var cc = scene.animationGroups.find(a => a.name === 'walk').clone();
BABYLON.AnimationGroup.MakeAnimationAdditive(cc, {cloneOriginalAnimationGroup:true});

You should also set cloneOriginalAnimation: true when calling MakeAnimationAdditive:

However, there’s a bug which prevents this code to work. Here’s the fix:

3 Likes

Thank you for the fix!