Morph target animation freezes when played for the first time

I have GLTF file exported from Blender with both morph target animation and skeletal (human head)

  • Expected result:
    both of animations play smoothly
  • Current result:
    morph target animation freezes when played for the first time, then plays smoothly at the next launch (.play() call). This does not depend from device or browser

Do you have any idea what it could be? Buffering? Some workarounds to fix this?

Additional context
Also noticed that if you pre-execute scene.freezeActiveMeshes() animation plays smoothly, but skeletal animation doesn’t work

Hey @starrabb1t

First and foremost, welcome to the Babylon family! It’s sincerely awesome to have you join us!

As a general rule around here, we ask everyone to supply playground examples when asking questions or troubleshooting. This helps us tremendously as we can pass specific solutions back and forth and get to resolutions faster.

If possible it would be awesome if you could provide a playground?

That said, try this:

yourLoadedMesh.morphTargetManager.optimizeInfluencers = false;

There’s an optimization that we do related to getting the scene ready for morphTarget animations. I’m not 100% familiar with it, but I believe this line of code should help.

Also adding @Evgeni_Popov to fill in for my ignorance and help explain the specifics of this.

1 Like

A repo in the Playground would help indeed. optimizeInfluencers has an effect only if target.influence == 0, I don’t know if that is your case(?)

That’s expected, when meshes are frozen the skeletons are not updated anymore. See Freeze Active Meshes and animations - #2 by Evgeni_Popov


Thank you very much! It worked!
And thanks for your amiability, I’m glad to join community:)

Thank you! That was my case exactly)