How do you animate a bone matrix property?

Hi! I’m wanting to animate the bones of a skeleton in my project. I was reading the documentation, and found:

A bone can contain animations to animate its matrix property.

Yet, I can’t find a matrix property when I try to log it:

BABYLON.SceneLoader.ImportMesh(
    "",
    "/models/",
    "mesh.glb",
    scene,
    function (newMeshes, particleSystems, skeletons) {
      console.log(skeletons[0].bones[0].matrix);
    }
  );

I don’t see a matrix property in Bone | Babylon.js Documentation (babylonjs.com), but there is a Bone.worldMatrixFromCache accessor and a Bone.getWorldMatrix method. And you can change a bone’s matrix with the Bone.updateMatrix method.

You normally don’t use matrix directly but update the position / rotation instead through bone.position / bone.rotationQuaternion.

2 Likes