Trying to attach a mesh to a bone as per instructions here
https://doc.babylonjs.com/features/featuresDeepDive/mesh/bonesSkeletons/#attaching-a-mesh-to-a-specific-bone
This works for a non glb/gltf skeleton like here
But not for a glb skeleton
see
The location of mesh seems off. I thought setting it zero would help but it doesn’t.
Does glb/gltf require special handling ?
Cedric
December 5, 2024, 9:13am
2
I believe the associated transform for a bone is found using:
sphere.attachToBone(skeleton.bones[0], skeleton.bones[0].getTransformNode());
But for some reason, there is an offset between the bone and the sphere. cc @Evgeni_Popov
I’m not sure attachToBone
is appropriate for glb meshes. At least, I wasn’t able to make it work… It’s a lot easier to simply parent the mesh to the transformed node linked to the bone:
2 Likes
satguru
December 5, 2024, 11:13pm
5
Nice. Thanks
Might be a good idea to update the document for GLTF/GLB meshes