# Keyframes from AnimationGroup with weight 0 not ignored

**URL:** <https://forum.babylonjs.com/t/keyframes-from-animationgroup-with-weight-0-not-ignored/49726>\
**Category:** Bugs\
**Tags:** glb, animationgroups\
**Created:** [April 16, 2024, 2:25pm UTC](https://forum.babylonjs.com/t/keyframes-from-animationgroup-with-weight-0-not-ignored/49726 "2024-04-16T14:25:10Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrmmatricks](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mrmmatricks/32/35472_2.png) [@mrmmatricks](https://forum.babylonjs.com/u/mrmmatricks)\
**Post date:** [April 16, 2024, 2:25pm UTC](https://forum.babylonjs.com/t/keyframes-from-animationgroup-with-weight-0-not-ignored/49726/1 "2024-04-16T14:25:10Z")

</div>

Hello!

I have an glb file with 3 Animation Groups, they all target the same armature.  
Only one of them has keyframes targeting the position, the others are just targeting rotations.

When I now set the weight of the only animation with the position animation to 0 the translation is still applied.

I have created an Playground with our glb file and a sample, I have also attached the glb file as a zip.

> **[Babylon.js Playground](https://www.babylonjs-playground.com/#XX4KGJ)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

You can test this behaviour in the playground by changing the currentFrame of the “falling” animation in the inspector.

[clippy\_Broken.zip](https://forum.babylonjs.com/uploads/short-url/6gdgmZ3jxXHzGqQXohRIRSu1ngP.zip) (8.9 KB)

---

<div class="post-metadata">

**Author:** ![11128](https://avatars.discourse-cdn.com/v4/letter/1/d07c76/32.png) [@11128](https://forum.babylonjs.com/u/11128)\
**Post date:** [April 17, 2024, 5:04am UTC](https://forum.babylonjs.com/t/keyframes-from-animationgroup-with-weight-0-not-ignored/49726/2 "2024-04-17T05:04:08Z")

</div>

currentFrame in the inspector appears to be forced to move  
The frame movement for basic animation operation appears to be operated by weight.  
“falling” appears to work for both position and rotation.

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [April 17, 2024, 8:27am UTC](https://forum.babylonjs.com/t/keyframes-from-animationgroup-with-weight-0-not-ignored/49726/3 "2024-04-17T08:27:18Z")

</div>

As @11128 said, changing the frame in the inspector uses `AnimationGroup.goToFrame`, which does the change even if weight is 0. `weight` is taken into account during regular animation replay only.

---

<div class="post-metadata">

**Author:** ![mrmmatricks](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mrmmatricks/32/35472_2.png) [@mrmmatricks](https://forum.babylonjs.com/u/mrmmatricks)\
**Post date:** [April 17, 2024, 9:00am UTC](https://forum.babylonjs.com/t/keyframes-from-animationgroup-with-weight-0-not-ignored/49726/4 "2024-04-17T09:00:57Z")

</div>

Sorry, I guess I have not really explaned the problem good enough. The changing of the currentFrame was just a test for myself to find out where the prolem is coming from.

The real problem is that the character should be in the origin (0,0,0) when the weight of the falling animation is set to zero. Because the armature is in the center and the other two animation have no keyframes set for position.

---

<div class="post-metadata">

**Author:** ![11128](https://avatars.discourse-cdn.com/v4/letter/1/d07c76/32.png) [@11128](https://forum.babylonjs.com/u/11128)\
**Post date:** [April 17, 2024, 9:20am UTC](https://forum.babylonjs.com/t/keyframes-from-animationgroup-with-weight-0-not-ignored/49726/5 "2024-04-17T09:20:24Z")

</div>

The y value of the model’s child Armature is about 6.169 (percentages are different in the tool).  
In other words, the animation (keyframe) is set as y goes down from 6 to 0.  
If you change it from 0 to -6 it will display correctly for the 0 value of world.

---

<div class="post-metadata">

**Author:** ![mrmmatricks](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mrmmatricks/32/35472_2.png) [@mrmmatricks](https://forum.babylonjs.com/u/mrmmatricks)\
**Post date:** [April 17, 2024, 2:46pm UTC](https://forum.babylonjs.com/t/keyframes-from-animationgroup-with-weight-0-not-ignored/49726/6 "2024-04-17T14:46:36Z")

</div>

How did you look this up?  
In blender (where it was modeled and animated) this armature is in the origin and when exported without the falling animation it is also in babylon in the origin. So my best guess was that the armature is correct but the animation still applies some translation to it even when the weight is 0.  
So maybe we do something wrong with the exporter?

---

<div class="post-metadata">

**Author:** ![11128](https://avatars.discourse-cdn.com/v4/letter/1/d07c76/32.png) [@11128](https://forum.babylonjs.com/u/11128)\
**Post date:** [April 18, 2024, 12:54am UTC](https://forum.babylonjs.com/t/keyframes-from-animationgroup-with-weight-0-not-ignored/49726/7 "2024-04-18T00:54:04Z")

</div>

The value itself was checked in the inspector hierarchy and appears to be related to the local  
and world space for animation work before exporting from blender.(We had a similar experience to this with our 3D model team)  
however even after working on this, if the same thing happens repeatedly,  
it looks like a different problem.(example: It is true that the postion moves when animation is executed.  
A problem where the final origin changes due to the local postion being changed just by working on the animation)  
Can you add an animation that moves diagonally downwards to the model?

> **[Reevaluating Worldspace and Localspace Treatment (need some dev triage)](https://devtalk.blender.org/t/reevaluating-worldspace-and-localspace-treatment-need-some-dev-triage/9665/74)**
>
> Hi Sybren, I suspected that there was a misunderstanding in terminology. I’m probably making confusion with the “Local” and “Global” coordinates system… I’m pretty confident that you are right and I have a misconception of what “relative to the...

---

<div class="post-metadata">

**Author:** ![mrmmatricks](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mrmmatricks/32/35472_2.png) [@mrmmatricks](https://forum.babylonjs.com/u/mrmmatricks)\
**Post date:** [April 18, 2024, 9:33am UTC](https://forum.babylonjs.com/t/keyframes-from-animationgroup-with-weight-0-not-ignored/49726/8 "2024-04-18T09:33:18Z")

</div>

Hello!

Thanks for the answers, I just now understood what you were saying in the second to last answer.  
The falling animation works just as expected. it should fall from 6 to 0. So the falling animation works just fine.

Our problem is that after changing the weight of the falling animation to 0 (so it should not influence the armature in any way) the armature is still at an y value of 6. But that should be zero. Because the falling animation should be “disabled”. Or did I misunderstand what the weight does in that case?

---

<div class="post-metadata">

**Author:** ![11128](https://avatars.discourse-cdn.com/v4/letter/1/d07c76/32.png) [@11128](https://forum.babylonjs.com/u/11128)\
**Post date:** [April 19, 2024, 5:02am UTC](https://forum.babylonjs.com/t/keyframes-from-animationgroup-with-weight-0-not-ignored/49726/9 "2024-04-19T05:02:22Z")

</div>

I tested a few things.

1. Containing the value 6-\>0 only as a keyframe.
2. Animation of attaching and moving bones.

We stopped each animation and forced the initial value to be 0.  
Even if no animations are triggered (except weights or animations on load)  
The initial value is already mapped to 6 at frame 0.

Also, the weight is controlled for the value between each frame movement, but it does not seem to be in the form of removing the value itself at 0 frame.  
This has already been mentioned : [Keyframes from AnimationGroup with weight 0 not ignored - #3 by Evgeni\_Popov](https://forum.babylonjs.com/t/keyframes-from-animationgroup-with-weight-0-not-ignored/49726/3)

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/9/5/95c1460624acfd50c2bc341590136d19924bb5b0.png)

So the conclusion is  
Controlling by weight does not seem to work as is, and giving the opposite value of the already mapped initial value (but this causes a defect in local space) also seems to cause problems.

---

<div class="post-metadata">

**Author:** ![mrmmatricks](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mrmmatricks/32/35472_2.png) [@mrmmatricks](https://forum.babylonjs.com/u/mrmmatricks)\
**Post date:** [April 19, 2024, 7:49am UTC](https://forum.babylonjs.com/t/keyframes-from-animationgroup-with-weight-0-not-ignored/49726/10 "2024-04-19T07:49:18Z")

</div>

So, do I understand you correctly that this _is_ a bug in babylon?

For now we just add position keyframes to the other animations as well thats makes the problem go away. But that is work and can easily be forgotten.

Is there a workaround that we can do in code?

Thanks anyways!

---

<div class="post-metadata">

**Author:** ![11128](https://avatars.discourse-cdn.com/v4/letter/1/d07c76/32.png) [@11128](https://forum.babylonjs.com/u/11128)\
**Post date:** [April 19, 2024, 8:26am UTC](https://forum.babylonjs.com/t/keyframes-from-animationgroup-with-weight-0-not-ignored/49726/11 "2024-04-19T08:26:28Z")

</div>

> [@mrmmatricks](#):
>
> So, do I understand you correctly that this _is_ a bug in babylon?

Since the weight was intended to be a mixed use of various animations, it seems that various opinions are needed to judge this as a bug.  
Rather, I am more suspicious of the fact that the initial value changes even though the animation is not activated.  
Is this a problem only with glb and gltf, or is it a rule for the overall model?

> [@mrmmatricks](#):
>
> For now we just add position keyframes to the other animations as well thats makes the problem go away. But that is work and can easily be forgotten.

A simple workaround would be to create a keyframe in the idel state, but you are aware that it violates what you want.

> [@mrmmatricks](#):
>
> Is there a workaround that we can do in code?

Generalization seems to require more manual work than the amount of model modification because there are “unknowns” depending on the structure of the model.

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [April 19, 2024, 9:25am UTC](https://forum.babylonjs.com/t/keyframes-from-animationgroup-with-weight-0-not-ignored/49726/12 "2024-04-19T09:25:02Z")

</div>

> [@mrmmatricks](#):
>
> Our problem is that after changing the weight of the falling animation to 0 (so it should not influence the armature in any way) the armature is still at an y value of 6. But that should be zero.

The initial position of the armature, without any animation, is 6.17. See this PG, where I removed all animations after they were loaded, to make sure they didn’t interfere:

> **[Babylon.js Playground](https://www.babylonjs-playground.com/#XX4KGJ%231)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

If you look at the **Armature** node in the inspector, you will see that the Y position is 6.17. If it should be 0, then it’s a problem at export time.

You can also check it if you transform the glb to gltf and look for the **Armature** node in the file:

```json
    {
      "children": [
        5,
        2
      ],
      "name": "Armature",
      "rotation": [
        -0.19885993003845215,
        0.58295583724975586,
        -0.492531418800354,
        0.6148415207862854
      ],
      "translation": [
        0,
        6.16932487487793,
        0.4978981614112854
      ]
    }

```

The Y value for “translation” is 6.169.
