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

**URL:** <https://forum.babylonjs.com/t/bug-feature-gltf-support-for-a-mesh-having-a-bone-as-parent/2145>\
**Category:** Bugs\
**Created:** [March 25, 2019, 6:38pm UTC](https://forum.babylonjs.com/t/bug-feature-gltf-support-for-a-mesh-having-a-bone-as-parent/2145 "2019-03-25T18:38:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mauricedoepke](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mauricedoepke/32/1360_2.png) [@mauricedoepke](https://forum.babylonjs.com/u/mauricedoepke)\
**Post date:** [March 25, 2019, 6:38pm UTC](https://forum.babylonjs.com/t/bug-feature-gltf-support-for-a-mesh-having-a-bone-as-parent/2145/1 "2019-03-25T18:38:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [March 25, 2019, 7:43pm UTC](https://forum.babylonjs.com/t/bug-feature-gltf-support-for-a-mesh-having-a-bone-as-parent/2145/2 "2019-03-25T19:43:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mauricedoepke](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mauricedoepke/32/1360_2.png) [@mauricedoepke](https://forum.babylonjs.com/u/mauricedoepke)\
**Post date:** [March 25, 2019, 8:50pm UTC](https://forum.babylonjs.com/t/bug-feature-gltf-support-for-a-mesh-having-a-bone-as-parent/2145/3 "2019-03-25T20:50:00Z")

</div>

Yes. Here: [https://www.babylonjs-playground.com/#JUKXQD#122](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.

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [March 25, 2019, 8:56pm UTC](https://forum.babylonjs.com/t/bug-feature-gltf-support-for-a-mesh-having-a-bone-as-parent/2145/4 "2019-03-25T20:56:42Z")

</div>

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](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/3/39ff12fc79eb22954a64d2d8093a7b3dadadff7b.zip) (1.4 KB)

---

<div class="post-metadata">

**Author:** ![mauricedoepke](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mauricedoepke/32/1360_2.png) [@mauricedoepke](https://forum.babylonjs.com/u/mauricedoepke)\
**Post date:** [March 25, 2019, 9:10pm UTC](https://forum.babylonjs.com/t/bug-feature-gltf-support-for-a-mesh-having-a-bone-as-parent/2145/5 "2019-03-25T21:10:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [March 25, 2019, 9:11pm UTC](https://forum.babylonjs.com/t/bug-feature-gltf-support-for-a-mesh-having-a-bone-as-parent/2145/6 "2019-03-25T21:11:16Z")

</div>

Yeah, sounds like a blender export issue.

---

<div class="post-metadata">

**Author:** ![mauricedoepke](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mauricedoepke/32/1360_2.png) [@mauricedoepke](https://forum.babylonjs.com/u/mauricedoepke)\
**Post date:** [March 25, 2019, 9:47pm UTC](https://forum.babylonjs.com/t/bug-feature-gltf-support-for-a-mesh-having-a-bone-as-parent/2145/7 "2019-03-25T21:47:32Z")

</div>

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.
