# Models broken when updating from v4 to v5/v6

**URL:** <https://forum.babylonjs.com/t/models-broken-when-updating-from-v4-to-v5-v6/43758>\
**Category:** Bugs\
**Tags:** upgrade, update\
**Created:** [September 1, 2023, 9:09am UTC](https://forum.babylonjs.com/t/models-broken-when-updating-from-v4-to-v5-v6/43758 "2023-09-01T09:09:43Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![trusktr](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/trusktr/32/840_2.png) [@trusktr](https://forum.babylonjs.com/u/trusktr)\
**Post date:** [September 1, 2023, 9:09am UTC](https://forum.babylonjs.com/t/models-broken-when-updating-from-v4-to-v5-v6/43758/1 "2023-09-01T09:09:43Z")

</div>

Are there known breaking changes between 4 and 5? In particular, animation broke (sporadic quick small movements). Any ideas?

Here’s the issue tracking the breakage in the particular project:

[Add support for BabylonJS v5 · Issue #155 · aws-samples/amazon-sumerian-hosts (github.com)](https://github.com/aws-samples/amazon-sumerian-hosts/issues/155)

If you run the project demo as is, you’ll see how they work, then update the Babylon version in package.json and you’ll see the breakage.

DM me for the AWS key (requires a bit of a dance inside the AWS UI setting up multiple services and exposing them through an Identity).

---

<div class="post-metadata">

**Author:** ![jeremy-coleman](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jeremy-coleman/32/15493_2.png) [@jeremy-coleman](https://forum.babylonjs.com/u/jeremy-coleman)\
**Post date:** [September 1, 2023, 10:12am UTC](https://forum.babylonjs.com/t/models-broken-when-updating-from-v4-to-v5-v6/43758/2 "2023-09-01T10:12:36Z")

</div>

from the docs here  
.[glTF 2.0 Skinning | Babylon.js Documentation](https://doc.babylonjs.com/features/featuresDeepDive/importers/glTF/glTFSkinning)  
says:  
" _NOTE: Before Babylon.js 5.0, the glTF loader uses a property `overrideMesh` that on the skeleton to override the mesh used by the skeleton in order to ignore the parent transform up to the glTF root node which contained the right-hand to left-hand conversion. This method, however, caused all sort of issues that are outside the scope of this document to explain. This property has since been removed from the skeleton class._

using that or not, there were still some changes to the structure of the json.

i only quickly looked at the sumarian host, i didnt see anything that stood out immediately besides accesing the animation group by 0 index. perhaps ` __root__ ` is now the 0 index and the animations are at 1. idk, maybe just console log the json and see what’s different, shouldn’t be too difficult to rule a change in shape of the parsed animations. i think if the parsed json is different, it could be the additive animations. i saw many broken playgrounds, but idk about any changes to additive animations first hand.

another maybe helpful thing is comparing these two playgrounds. somewhat illustrates how the changes to the json can be breaking.  
[https://playground.babylonjs.com/#WKJTFD#42](https://playground.babylonjs.com/#WKJTFD#42) (working in v4, broke in v5/6)  
[https://playground.babylonjs.com/#WKJTFD#57](https://playground.babylonjs.com/#WKJTFD#57) (fixed)  
see around lines ~215 for the changes

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [September 1, 2023, 11:22am UTC](https://forum.babylonjs.com/t/models-broken-when-updating-from-v4-to-v5-v6/43758/3 "2023-09-01T11:22:35Z")

</div>

cc @Evgeni_Popov

---

<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:** [September 1, 2023, 11:53am UTC](https://forum.babylonjs.com/t/models-broken-when-updating-from-v4-to-v5-v6/43758/4 "2023-09-01T11:53:43Z")

</div>

As @jeremy-coleman pointed, we have a breaking change when loading a glTF file in 5.0.

For context, here’s the post from @bghgary regarding the PGs:

> [@Breaking Changes In GLTF Loader](https://forum.babylonjs.com/t/breaking-changes-in-gltf-loader/32807/27):
>
> Maybe better to start a new thread for this. I don’t know what I’m looking at for the PG. Can you explain what is broken? EDIT: I figured out what is wrong. Here is a fixed version: [glTF Animation Retargeting Demo | Babylon.js Playground (babylonjs.com)](https://playground.babylonjs.com/#WKJTFD#57) The reason why there is a problem is because [the way glTF skeletons work is a bit different now](https://doc.babylonjs.com/features/featuresDeepDive/importers/glTF/glTFSkinning). But the PG code has a bit of a bug in it since it de-parents the meshes instead of what I think is the intention. Once I fixed that, it works wel…

Also, make sure to have a look at the breaking changes for v5, as there are more than usual:

> **[Babylon.js docs](https://doc.babylonjs.com/whats-new)**

(search for “5.0.0” then “Breaking changes”)

---

<div class="post-metadata">

**Author:** ![jeremy-coleman](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jeremy-coleman/32/15493_2.png) [@jeremy-coleman](https://forum.babylonjs.com/u/jeremy-coleman)\
**Post date:** [September 2, 2023, 10:05am UTC](https://forum.babylonjs.com/t/models-broken-when-updating-from-v4-to-v5-v6/43758/5 "2023-09-02T10:05:38Z")

</div>

cc @trusktr

I think additive animation blending is broken.

this is playground is one from the docs on animation blending.  
.[Advanced Animation Methods | Babylon.js Documentation](https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations)  
.[https://playground.babylonjs.com/#6I67BL#321](https://playground.babylonjs.com/#6I67BL#321)

i opened the playground twice, so i had two tabs open. i played the animations and adjusted some weights and the skeleton was deforming. but i noticed, the skeleton was deforming in the same way from adjusting _different_ animations. the screenshots below show the problem. the first two pictures are from tab1, and the last 3 are from tab2. In the first two, adjusting “head shake” caused her to go cross armed. In tab2, adjusting “agree” caused her to go cross-armed. Finally, i adjusted “head shake” in tab2 just to show it has no effect, while in tab1, it is the cause of the problem. (instructions to reproduce below).

 ![Slide1](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/f/1/f14137525c270fbaebf603b3b14994d6bff3a0dc.jpeg)  
 ![Slide2](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/6/6/66b92b250d654c8bbd7fe7b97d9e63d0011c6741.jpeg)  
 ![Slide3](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/1/c/1c38dfc9294b81d01f45630e3675ecd74cb761a9.jpeg)  
 ![Slide4](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/b/b/bbace1484a38e06c3d45514fd79eb1119f854d3c.jpeg)  
 ![Slide5](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/e/d/edcb4ad8825f30201e15e1d8222184812942a662.jpeg)

steps to reproduce:

open the playground here  
.[https://playground.babylonjs.com/#6I67BL#321](https://playground.babylonjs.com/#6I67BL#321)

play the “walk” animation.  
adjust animations in this order: sad → sneak → head → agree.  
“agree” will cause the model to become deformed

reopen the playground to reset animations.

play the “walk” animation  
adjust animations in this order: sneak → head → agree → sad  
“sad” will cause the model to become deformed

What is the actual reproducing action here? is it just using any more than 3 additive blending animations will cause the problem?

---

<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:** [September 2, 2023, 3:58pm UTC](https://forum.babylonjs.com/t/models-broken-when-updating-from-v4-to-v5-v6/43758/6 "2023-09-02T15:58:41Z")

</div>

The problem is that the PR is a bit bugged, but the bug makes your use case work…

If you select v5.71.1 in the Playground and apply your steps, it works. Now, if you set 0 in line 228 instead of `param.anim.weight`, it does not work anymore. That’s because `param.anim.weight`does not exist and return `undefined`. Because the slider value is set to `undefined`, the `onValueChangedObservable` is immediately called with the `0` value, to set a legitimate value. This is done for all the 4 additive animations, which initializes them correctly.

The bug in the PG is that the 4 additive animations should be initialized with a 0 weight. The default one (-1) is invalid for additive animations.

So, here’s a fixed PG, using the `AnimationGroup.weight` property instead of calling `setWeightForAllAnimatables` manually:

> **[Babylon.js Playground](https://playground.babylonjs.com/#6I67BL%23451)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

I also fixed the PG in the doc:

> <https://github.com/BabylonJS/Documentation/pull/960>
>
> See https://forum.babylonjs.com/t/models-broken-when-updating-from-v4-to-v5/4375…8/5

---

<div class="post-metadata">

**Author:** ![jeremy-coleman](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jeremy-coleman/32/15493_2.png) [@jeremy-coleman](https://forum.babylonjs.com/u/jeremy-coleman)\
**Post date:** [September 3, 2023, 2:09am UTC](https://forum.babylonjs.com/t/models-broken-when-updating-from-v4-to-v5-v6/43758/7 "2023-09-03T02:09:43Z")

</div>

nice, maybe some useful insight for truskr / amazon folks

also noteworthy change i think:

```js
slider.onValueChangedObservable.add((v) => {
 				param.anim.weight = v;
				param.weight = v;
				header.text = param.name + ":" + param.weight.toFixed(2);
})

```

changed to:

```js
slider.onValueChangedObservable.add((v) => {
			param.anim.setWeightForAllAnimatables(v);
			param.weight = v;
			header.text = param.name + ":" + param.weight.toFixed(2);
})

```

---

<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:** [September 3, 2023, 9:44am UTC](https://forum.babylonjs.com/t/models-broken-when-updating-from-v4-to-v5-v6/43758/8 "2023-09-03T09:44:05Z")

</div>

I changed to `param.anim.weight = v;` because it’s more logical now that we have a `weight` property on the `AnimationGroup`, but calling `setWeightForAllAnimatables` still work.

---

<div class="post-metadata">

**Author:** ![trusktr](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/trusktr/32/840_2.png) [@trusktr](https://forum.babylonjs.com/u/trusktr)\
**Post date:** [February 17, 2024, 1:16am UTC](https://forum.babylonjs.com/t/models-broken-when-updating-from-v4-to-v5-v6/43758/9 "2024-02-17T01:16:05Z")

</div>

I’m not sure what the problem is with Amazon Sumerian models. But I noticed something.

If I take the above broken Babylon example, [https://playground.babylonjs.com/#6I67BL#321](https://playground.babylonjs.com/#6I67BL#321), and _ **downgrade** _ it to 4.x, it starts to shake like this:

[![](https://img.youtube.com/vi/Gq-ETEnVvV4/maxresdefault.jpg "babylon animation demo broken in 4.x") ](https://www.youtube.com/watch?v=Gq-ETEnVvV4)

I am also experiencing vibration like that when _ **upgrading** _ from 4.x to 5.x:

[![](https://img.youtube.com/vi/M36NJHTLFyA/maxresdefault.jpg "amazon sumerian vibrating animation in babylon 5.x") ](https://www.youtube.com/watch?v=M36NJHTLFyA)

Note the face shape is all distorted too.

Does this provide any clues?

Here’s the open source: [amazon-sumerian-hosts/packages/amazon-sumerian-hosts-babylon/src/Babylon.js/HostObject.js at mainline2.0 · aws-samples/amazon-sumerian-hosts · GitHub](https://github.com/aws-samples/amazon-sumerian-hosts/blob/mainline2.0/packages/amazon-sumerian-hosts-babylon/src/Babylon.js/HostObject.js)

(search for “animation” and you’ll find lots of results).

Do you see anything wrong there?

I looked at [https://doc.babylonjs.com/whats-new](https://doc.babylonjs.com/whats-new), but I don’t see anything obvious.

---

<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:** [February 19, 2024, 9:31am UTC](https://forum.babylonjs.com/t/models-broken-when-updating-from-v4-to-v5-v6/43758/10 "2024-02-19T09:31:38Z")

</div>

Does it work in the latest version of Babylon? We did quite a few number of fixes and improvements since v4 / v5:

> **[Issues · BabylonJS/Babylon.js](https://github.com/BabylonJS/Babylon.js/issues?q=is%3Aclosed%2Blabel%3Aanimations%2B)**
>
> Babylon.js is a powerful, beautiful, simple, and open game and rendering engine packed into a friendly JavaScript framework. - Issues · BabylonJS/Babylon.js

Also, these threads could help:

- [Major GLTF Importer Bug: FAILED SKELETONS](https://forum.babylonjs.com/t/major-gltf-importer-bug-failed-skeletons/21715)
- [Apparent regression in multipass rendering demo - #3 by bghgary](https://forum.babylonjs.com/t/apparent-regression-in-multipass-rendering-demo/32470/3)
- [GLB file not loaded correctly - #14 by bghgary](https://forum.babylonjs.com/t/glb-file-not-loaded-correctly/42428/14) / [GLB file not loaded correctly - #15 by bghgary](https://forum.babylonjs.com/t/glb-file-not-loaded-correctly/42428/15) =\> [Mixamo -\> Blender -\> BJS issue - #20 by bghgary](https://forum.babylonjs.com/t/mixamo-blender-bjs-issue/24117/20)
