Animations does not work anymore after loading and applying a new material from a json

Hey there i’m quite new to babylonjs so maybe thats a simple thing tho.

I’m loading a gltf file from our customer into babylon. This file comes with an animation group that we’re animating.

The application we’re building lets the user change materials. Those materials are loaded as JSON file from s3.

The moment i apply a material to an mesh which was covered by the animationgroup before, the mesh does not animate anymore.

After my research it seems that since the material comes with blocks those blocks are not covered by the animation group.

Now my question is how can i make the old animations to work on the mesh with the new material applied on.

Unfortunatly it would be hard to create a playground. If that would be needed i will ask my customer for the permission to share.

Thats the process to apply the net material

 * This function loads the **new Material and adds it to the given mesh**
export async function replaceMaterial(
  material: Material,
  mesh: AbstractMesh,
  scene: Scene,
) {
  const createUrlCreator = (base_path: string) => (path: string) =>

  const urlCreator = createUrlCreator(material.path)

  const newMaterial = await NodeMaterial.ParseFromFileAsync(

  if (!mesh.metadata?.oldMaterial) {
    mesh.metadata = { ...mesh.metadata, oldMaterial: mesh.material }
  mesh.material = newMaterial

Hello! Welcome to the community!
The node material is probably missing the “Bones” block if the animation is skeletal:

If you can modify the received material, you could create this block through code ( Node Material | Babylon.js Documentation ( and wire in the appropriate input. Or you could ask the user to add this block too.


Hello there, thanks for your message. Unfortunately i have no skeletal. It’s an book that i have to open and close.

If your animation is a morph, you will have to use the MorphTargets block: