Breaking Changes In GLTF Loader

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

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

Before it was:

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

Now it is:

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

loadAnimationAsync will call _loadAnimationChannelAsync like this:

this._loadAnimationChannelAsync(`${context}/channels/${channel.index}`, context, animation, channel, (babylonTarget, babylonAnimation) => {
    babylonTarget.animations = babylonTarget.animations || [];
    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?

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

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

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 ?


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

1 Like

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

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?

cc @Drigax because its his

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 (

The reason why there is a problem is because the way glTF skeletons work is a bit different now. 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.


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

1 Like

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

Browser Console

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

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

5.26 will be released thursday morning.