Modify bones in a GLTF skinned mesh after it's loaded

I load a GLTF file containing a skinned mesh that is rigged to a simple skeleton.

Is there a way to iterate over the bones and modify them - E.G. scale each slightly?

If I iterate over the loaded model and change the scale or each object of type “Bone”, I don’t any difference in the resulting mesh when it is displayed.

I wondered if I need to flag the mesh as ‘dirty’ using a needsUpdate pattern elsewhere but I wasn’t able to find an example of that.

I also thought I might be able to use SkeletonUtils::getBones(skeleton) and iterate over that directly but I don’t know what to pass into that function.

Can anyone point me to an example?

1 Like

You can use Object3D.traverse() on the top level object of the imported model, then check which nodes are Bones.

gltfLoader.load(..., gltf => {
  const topLevelObject = gltf.scene

  topLevelObject.traverse(n => {
    if (n.isBone) console.log('found bone: ', n)
  })
})

(untested, but something like that)