# Breaking Changes In GLTF Loader

**URL:** <https://forum.babylonjs.com/t/breaking-changes-in-gltf-loader/32807>\
**Category:** Questions\
**Created:** [August 5, 2022, 8:00pm UTC](https://forum.babylonjs.com/t/breaking-changes-in-gltf-loader/32807 "2022-08-05T20:00:06Z")\
**Posts on this page:** 12\
**Page:** 2

<div class="post-metadata">

**Author:** ![MackeyK24](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mackeyk24/32/3741_2.png) [@MackeyK24](https://forum.babylonjs.com/u/MackeyK24)\
**Post date:** [September 22, 2022, 8:50pm UTC](https://forum.babylonjs.com/t/breaking-changes-in-gltf-loader/32807/21 "2022-09-22T20:50:34Z")

</div>

Sorry… @bghgary Not quite sure how to actually use the hooks you just made. can you please show me the setup to hook into the loadAnimation event

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [September 22, 2022, 10:17pm UTC](https://forum.babylonjs.com/t/breaking-changes-in-gltf-loader/32807/22 "2022-09-22T22:17:04Z")

</div>

Hooking into the `loadAnimationAsync` is the same as before and should be called now. The `_loadAnimationChannelAsync` is slightly different than before.

Before it was:

```javascript
    _loadAnimationChannelAsync(
        context: string,
        animationContext: string,
        animation: IAnimation,
        channel: IAnimationChannel,
        babylonAnimationGroup: AnimationGroup,
        animationTargetOverride: Nullable<IAnimatable> = null
    ): Promise<void> {

```

Now it is:

```javascript
    _loadAnimationChannelAsync(
        context: string,
        animationContext: string,
        animation: IAnimation,
        channel: IAnimationChannel,
        onLoad: (babylonAnimatable: IAnimatable, babylonAnimation: Animation) => void
    ): Promise<void>;

```

`loadAnimationAsync` will call `_loadAnimationChannelAsync` like [this](https://github.com/BabylonJS/Babylon.js/blob/master/packages/dev/loaders/src/glTF/2.0/glTFLoader.ts#L1550-L1553):

```javascript
this._loadAnimationChannelAsync(`${context}/channels/${channel.index}`, context, animation, channel, (babylonTarget, babylonAnimation) => {
    babylonTarget.animations = babylonTarget.animations || [];
    babylonTarget.animations.push(babylonAnimation);
    babylonAnimationGroup.addTargetedAnimation(babylonAnimation, babylonTarget);

```

You should be able to do what you want now using the new function and override the target in the onLoad callback.

I’ve also added a loader extension function for `_loadAnimationChannelAsync` itself if you want to override that directly instead.

Does this help?

---

<div class="post-metadata">

**Author:** ![MackeyK24](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mackeyk24/32/3741_2.png) [@MackeyK24](https://forum.babylonjs.com/u/MackeyK24)\
**Post date:** [September 23, 2022, 10:30am UTC](https://forum.babylonjs.com/t/breaking-changes-in-gltf-loader/32807/23 "2022-09-23T10:30:13Z")

</div>

> [@bghgary](#):
>
> \_loadAnimationChannelAsync

Man im real confused on how or what changed in loadAnimationAsync.

I got the latest 5.25.0 release build… I dont even see a function in the project called  
\*\* \_loadAnimationChannelAsync\*\* except in the KHR\_animation\_pointer.ts

my old code (before 5.18.0 this worked). All i did is name a function on my custom GLTF extension call **loadAnimationAsync** … I copied the body of that function from the babylon src  
GLTFLoader.ts and made my teaks… worked great for years

 ![Screen Shot 2022-09-23 at 12.18.55 AM](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/e/2/e2f59d61cfe2ffa46b0609b5e3e2f30c398e4931.png)

Now i see the body of the function has changed greatly to accommodate for all you new animation features (i guess)

 ![Screen Shot 2022-09-23 at 12.25.56 AM](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/f/c/fcb8b3f4384e14894bb023f39a3c062b054559cb.png)

But when make my tweaks (basically coping over the metadata from IAnimation to AnimationGroup.metadata)

It does not work… actually seems like it throws something off in the life cycle and finally calling **executeWhenReady**

So the new way does not like just copying the original **loadAnimationAsync** tweak that a bit and using that as my overridden **loadAnimationAsync**

I dont understand all the \_loadAnimationChannelAsync hooks… i dont even see a function to call in the GLTFLoader.ts

I dont see it calling \_loadAnimationChannelAsync anywhere ?

Maybe your update is not in the 5.25.0 release ?

☹

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [September 23, 2022, 2:41pm UTC](https://forum.babylonjs.com/t/breaking-changes-in-gltf-loader/32807/24 "2022-09-23T14:41:15Z")

</div>

I’m not sure this is available in a package yet. It was just merged. The code you are referencing is old.

---

<div class="post-metadata">

**Author:** ![MackeyK24](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mackeyk24/32/3741_2.png) [@MackeyK24](https://forum.babylonjs.com/u/MackeyK24)\
**Post date:** [September 23, 2022, 6:30pm UTC](https://forum.babylonjs.com/t/breaking-changes-in-gltf-loader/32807/25 "2022-09-23T18:30:41Z")

</div>

Kool… That makes sense … Thanks for all help on this… I’ll wait for it to get packaged in latest release and try override loadAnimationChannelAsync instead

---

<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 23, 2022, 6:32pm UTC](https://forum.babylonjs.com/t/breaking-changes-in-gltf-loader/32807/26 "2022-09-23T18:32:15Z")

</div>

this pg is broken in v5 but does work if you change version to 4.21. It is my go-to example for animation retargeting. Is this expected to be broken?

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

cc @Drigax because its his

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [September 23, 2022, 7:57pm UTC](https://forum.babylonjs.com/t/breaking-changes-in-gltf-loader/32807/27 "2022-09-23T19:57:19Z")

</div>

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 well now.

---

<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 23, 2022, 9:18pm UTC](https://forum.babylonjs.com/t/breaking-changes-in-gltf-loader/32807/28 "2022-09-23T21:18:44Z")

</div>

ah, i see the small change to the ` __root__ ` node. very glad this wasn’t a big deal. thank you very much sir.

---

<div class="post-metadata">

**Author:** ![MackeyK24](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mackeyk24/32/3741_2.png) [@MackeyK24](https://forum.babylonjs.com/u/MackeyK24)\
**Post date:** [September 24, 2022, 2:57am UTC](https://forum.babylonjs.com/t/breaking-changes-in-gltf-loader/32807/29 "2022-09-24T02:57:27Z")

</div>

Yo @bghgary … I download the 5.25.0 release. Now in my override i get \_loadAnimationChannelAsync does not exists

 ![Screen Shot 2022-09-23 at 4.56.42 PM](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/2/2/22adff41939dc4f72eb25ecedf105cafdf15af7b.png)

Browser Console

 ![Screen Shot 2022-09-23 at 4.59.54 PM](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/d/0/d043da21c4e7fa88ecc2c48a08a2a555f0d39778.png)

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [September 26, 2022, 8:05pm UTC](https://forum.babylonjs.com/t/breaking-changes-in-gltf-loader/32807/30 "2022-09-26T20:05:07Z")

</div>

5.25.0 was released 5 days ago and still doesn’t have my changes. @RaananW When is the next package?

---

<div class="post-metadata">

**Author:** ![MackeyK24](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mackeyk24/32/3741_2.png) [@MackeyK24](https://forum.babylonjs.com/u/MackeyK24)\
**Post date:** [September 26, 2022, 9:45pm UTC](https://forum.babylonjs.com/t/breaking-changes-in-gltf-loader/32807/31 "2022-09-26T21:45:29Z")

</div>

That what i was thinking … so I am trying to build from latest source … but having issues finding where things are with the new build system

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [September 27, 2022, 9:11am UTC](https://forum.babylonjs.com/t/breaking-changes-in-gltf-loader/32807/32 "2022-09-27T09:11:49Z")

</div>

5.26 will be released thursday morning.

[Previous page](https://forum.babylonjs.com/t/breaking-changes-in-gltf-loader/32807.md?page=1)
