This may be a bug with the inspector, or perhaps it is user error.
I created a simple box mesh in blender with 5 bones and exported the scene as .babylon file. When the scene is loaded into the playground only 4 bones are visible.
In addition, when bringing up the transform gizmos on a highlighted bone, the gizmo (whether it’s rotation, translation or scale) is not superimposed at the correct pivot points matching where the bones are placed in the scene. The gizmo is far too low.
Is this a bug? Or a problem with my .babylon exported file? The raw data is in the playground.
About the view of the bones, the position of the bone itself is represented by the sphere and there’s 5 spheres. The thing is that to draw the spur that goes out from the sphere, the children of the bone are checked: Babylon.js/skeletonViewer.ts at 28257aef7dc94d4aee2af17a34dbb4cc4914902d · BabylonJS/Babylon.js · GitHub, and the last bone has no children. If we display lines instead of spheres and spurs we see the 5 lines as we expect, so I think we could change the spheres and spurs calculation to be more alike the lines calculation
About the gizmos, I think this might be related to the bone transform matrices? pinging @Cedric and @bghgary who probably have a better idea of what could be going on.
@Evgeni_Popov might know more also.
Bones are at a particular position but the skinned mesh is at another one.
It’s parented to
Cube that has a Y value of 5.
So, basically, the skinned mesh is properly deformed by the bones but whole mesh is translated 5 units upward.
What’s wrong here is the skeleton viewer taking account of that parent mesh but not the bone/gizmo.
When we use the inspector, we have no way of finding the mesh to which the skeleton, of which this bone is part, is attached. Indeed, a skeleton can be used by several meshes, and it would be necessary that the user indicates the mesh to be taken into account.
As a workaround, perhaps we could enhance the skeleton viewer to display the axis of each bone? I have added it to Animation Improvements · Issue #13534 · BabylonJS/Babylon.js · GitHub
This is because the file was exported from blender to Babylon as a .babylon file, and in this case we have the length of the bone as a property of each bone. So we should be able to reuse the length in the “sphere and spur” case to display the last bone.
However, when it is a .gltf file (or any other file format), we do not have a bone length, so we cannot display the last bone, even in “line” mode. I’ve updated the “Animation Enhancements” to try to find a solution.