Bone.position not working in imported GLB file

Hi all,

First of all, thank you for this awesome community. This is my first question and let me know if you need additional information regarding the bug so that I can post it here.

I exported a basic cube with bones from Blender into the GLB format and imported it using the ImportMesh function. In the onSuccess callback, I am not able to set the position of the bone using bone.position. The bone.position works when I put the code in the runRenderLoop method.

Playground Link - https://www.babylonjs-playground.com/#T8C502#2

While searching for solutions I found that it works using the .babylon format. I used the Blender Babylon exporter to export the same cube with bones and it works as expected. Using the .babylon file I don’t need to set it constantly in the runRenderLoop function. I can set the bone position once and it gets applied.

Playground Link - https://www.babylonjs-playground.com/#IPZ0S8

I am not sure why there is 2 different behaviours for the same file. I don’t want to set the bone position in the runRenderLoop method as this will result in memory issues for the final project which I am working on as it has a lot of modules and moving parts.

Thanks in advance

Welcome aboard!

Because of specificities of the gltf/glb format, the bones of a skeleton must be manipulated through the transform nodes corresponding to those bones and not directly through the bones themselves when the skeleton is loaded from a gltf/glb file.

Manipulate the bone hierarchy from here:
image
and not from here:
image

Here’s a working PG:

https://www.babylonjs-playground.com/#T8C502#3

2 Likes

Works like a charm. Thank you :raised_hands: