Bug/Feature Gltf support for a mesh having a bone as parent

I just learned that if you want a mesh to be attached/behave like a child of a bone in Babylon you have to do it in this way.
mesh.attachToBone(bone, meshOfSkeleton)

Reading through a Blender exported gltf, it seems, that gltf and the Blender exporter support having a mesh being a child of a bone.

Could we extend the gltf loader to properly call the attachToBone function in this scenario? Currently it does not seem to do that.

@bghgary

Do you have an example where this doesn’t already work? I’m not calling attachToBone, but the nodes are animated in a way that should support whatever glTF supports, including mesh being a child of a bone.

Yes. Here: https://www.babylonjs-playground.com/#JUKXQD#122

The box is a child of the bone in the blender file (link in the comments)

If I just load it, it doesn’t work. I have to manually attach it.

This isn’t a loader issue to me. The glTF you referenced has the Bone as a sibling of the Cube. If the Cube node were a child of the Bone node, then it does work.

Modified example with Cube as a child of Bone.
bone.zip (1.4 KB)

1 Like

Sorry, you’re totally right, i got that wrong. So I would need to ask the people in the Khronos repo whether they would implement that? Because in the blender file the box is definitely a child of the bone, I doublechecked that.

Yeah, sounds like a blender export issue.

1 Like

In case someone has a similar issue:

This has already been fixed in the master branch of the gltf2 blender exporter.
At least the blender version I downloaded some days ago didn’t include that feature, yet.

1 Like