Not able to blend animation with beginWeightedAnimation

Hi there,

I am trying to blend my animation but it is not working as shown in the example

I have created a GLB file with all the animation in one animation group but they are not working

Please help me with this, thank you in advance

Hi, are you sure the weighted animations are defined correctly? What is the reason for the model to simply play all animations randomly?

all the animations are in the same clip

not what I asked :slight_smile:

Notice how the original playground is showing this when you turn off all weighted animations:

Your model’s animation definition is incorrect.

how can i correct them

i believe it has something to do with the way you are exporting it, but @PatrickRyan probably has a better answer.

@Shubham, I looked into the file and what I think is happening is that you have an animation group saved into your glTF (which should be coming from the exporter from whatever DCC tool you are using). What I believe is happening is there is a conflict between the animation groups (which automatically start playing when the glTF is loaded) and assigning new animatables to the same skeleton with beginWeightedAnimation. You could try exporting your file without animation groups and I am guessing this would solve the issue.

However, I think there may be something we need to do in engine so I am going to summon @Deltakosh as he wrote most of the animation logic and @RaananW for backup as DeltaKosh is on vacation next week. From what I debugged, the animatables are being created by beginWeightedAnimation but if there was any weight assigned in the constructor, the animation would “stop” and then dispose as disposeOnEnd was set to the default true. So basically, every time the scene would start (with animation groups stopped or even disposed) would start any animatable with weight, then immediately stop and dispose of it. Setting disposeOnEnd to false prevents the animatables from being disposed, but they never start playing. The animationStarted parameter remains false, even if the animatable is given weight in the constructor.

The scene I set up with some logging and added parameters is here but you can see in the scene below that the idle animation has weight, but the animatable thinks animationStarted is false.

1 Like

So i am using blender to export all the animation in one clip, and i am taking the animations from mixamo. how can i remove the animation groups from the gltf

Actually what i am doing is i am import this model in my web app on application start and then on runtime i am importing more models which doesn’t have animation to it they have the same armature as the one that i imported before, then i am cloning the animation from the old model and retargeting to the new ones and now i want to blend the animations in new model

assigning myself, and I hope to find time this week to check that. Otherwise we’ll wait for @Deltakosh :slight_smile:

hi @RaananW got any solution for my problem

@PatrickRyan has provided you with a solution that should be a fix on your end. What I am going to check, either today or tomorrow, is the second issue, which might be something that needs to be fixed in the framework itself. Would be great if you tried the suggestion and notified us if it worked for you.

1 Like

@PatrickRyan @RaananW, sorry I couldn’t test this earlier as I was working on other stuff. I tried the solution but it’s not working, I have removed the animation from the glTF now it is not playing any animations.

You can check here:

@Shubham, what you actually need to remove from the glTF is the animation groups, not the animations themselves. The Blender exporter seems to set by default Group by NLA Track in the glTF exporter:

Unchecking that should not group any animations in your file. Give that a try and let us know if that solves your issue.

1 Like

@PatrickRyan, I tried unchecking the Group by NLA Track but it didn’t work, it is playing all the animation as before

Actually, I combined all the animation in one clip, is that the right way to do it?

or else can you tell me how to export animations in blender from the scratch

I’m not super familiar with exporting animations from blender. Pinging @PirateJC!

hi @PatrickRyan, can you ping @PirateJC again?

Hey @Shubham Sorry for the delayed response. I’ll take a look right now. I’m not an expert, but I’ll see what I can discover.