Understanding Skeletons and Bones

I know that the usual way to deal with meshes with skeletons and animations is to produce them in something like Blender and import into Babylon.js. However I like to get right down to basics in order to learn and understand.

My expectations of how bones and skeletons work is completely wrong. I finally worked out how to rotate a bone but then expected the linked mesh to rotate with it.

In this PG from an already created skeleton animation I rotate a bone and the mesh rotates as well

When I try to construct my own example the bone rotates but not the mesh, using either rotation or rotationQuaternion.


I would be grateful if anyone can offer advice on this issue and even more so if they could give further explanation of the working of skeletons and bones in Babylon.js:slightly_smiling_face:

1 Like

After a bit of digging in the source code of Bone / Skeleton, I find that you should call:


after you change the position or quaternion of bone0, to trigger some internal recalculations:


Also, you did:

    for (var i = 0; i < nbVertices; i++) {
        m.push(0.5, 0.15, 0.35, 0.25);
        mi.push(1, 0, 0, 1);

mi holds the bone indices to use for each vertex. As you have a single bone, you should use index 0 for all 4 influences.

Regarding m (weights), the sum should equal to 1, but I think Babylon is doing a renormalization on its own.


@Evgeni_Popov thank you, that has taken me a step further forward.