AnimationGroups blending only for imported gltf

Hi! I have been looking for a solution, and similar questions have been ask before, but i havent find a proper answer.

Lets say I load a 3d asset. whenever the character is doing A I want to play animationGroups[0] and if the character is doing B animationGroups[1]. I want to have a smooth transition between them. How to do that?

I have found examples for normal animations, skeleton animations(which I understand are trigger in a different manner?) and enabling blending for everything in the scene(which affect my other animations)

i have a PG here:

As you mentioned you can turn animation blending for the entire scene or only on a per animation basis.

So technically you should be able to do something like that:

for (var index = 0; index < animationGroups[0].targetedAnimations.length; index++) {
   var animation = animationGroups[0].targetedAnimations[index].animation;
   animation.enableBlending = true;
   animation.blendingSpeed = 0.01;
1 Like

great thanks! ill give it a try!


it didnt work :frowning:
according to this example, stop current and play new should work:

but it is not working, here is my pg:

it is not blending, is just making a full stop and playing the new animation . what else can be missing?

Check you console:

You were calling animationsGroups out of nowhere. it is scene.animationGroups

I fixed it here:

Ah! I See! Thank You very much! now i can finish my game :slight_smile:

Hi! The code worked, but i dont know what is hapenning.

What are those targetedAnimations arrays? and the .animation? how should I understand them? I find it confusing because i tought the animationGroups contained already everything needed to play/stop the animation. The documentation says “Gets the targeted animations for this animation group” :smiley:


An animationGroup is a group of animations. An animation by default is generic and can be applied to many targets.

Inside an animationGroup you have an array of targetedAnimations which are animations with a target (an object where the animation will be applied)

Does it make sense?

1 Like