# Bone not rotating with parent

**URL:** <https://forum.babylonjs.com/t/bone-not-rotating-with-parent/54768>\
**Category:** Questions\
**Created:** [November 14, 2024, 6:33pm UTC](https://forum.babylonjs.com/t/bone-not-rotating-with-parent/54768 "2024-11-14T18:33:54Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Khanon](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/khanon/32/14980_2.png) [@Khanon](https://forum.babylonjs.com/u/Khanon)\
**Post date:** [November 14, 2024, 6:33pm UTC](https://forum.babylonjs.com/t/bone-not-rotating-with-parent/54768/1 "2024-11-14T18:33:54Z")

</div>

Hi,

Using quad meshes to represent sprites, I’m attaching different pieces to the actor body to compose it.

When attaching a quad mesh to the parent body, the bone is not following the rotation of the parent.

Am I doing something wrong here?

> **[Babylon.js Playground](https://playground.babylonjs.com/#YM8MSS%232)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

---

<div class="post-metadata">

**Author:** ![Joe\_Kerr](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/joe_kerr/32/39017_2.png) [@Joe\_Kerr](https://forum.babylonjs.com/u/Joe_Kerr)\
**Post date:** [November 15, 2024, 8:52am UTC](https://forum.babylonjs.com/t/bone-not-rotating-with-parent/54768/2 "2024-11-15T08:52:43Z")

</div>

[https://playground.babylonjs.com/#YM8MSS#3](https://playground.babylonjs.com/#YM8MSS#3) You forgot to link bone - mesh. Not sure if it should rotate like that?

N.B. I could have sworn that you can set it up in a way where you can transform the bones directly.

N.B.2: Keep in mind that there is “vertex weights” which you are not dealingh with here at all. So there probably is some more work to do.

---

<div class="post-metadata">

**Author:** ![Khanon](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/khanon/32/14980_2.png) [@Khanon](https://forum.babylonjs.com/u/Khanon)\
**Post date:** [November 15, 2024, 9:24am UTC](https://forum.babylonjs.com/t/bone-not-rotating-with-parent/54768/3 "2024-11-15T09:24:01Z")

</div>

Now it rotates, but… the rotation is not according to the parent.

---

<div class="post-metadata">

**Author:** ![Tricotou](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tricotou/32/5844_2.png) [@Tricotou](https://forum.babylonjs.com/u/Tricotou)\
**Post date:** [November 15, 2024, 9:40am UTC](https://forum.babylonjs.com/t/bone-not-rotating-with-parent/54768/4 "2024-11-15T09:40:45Z")

</div>

Hello 🙂

I think your problem comes from the fact that you have no root bone.

Try this :

```javascript
const boneROOT = new BABYLON.Bone('bone', quadMesh1.skeleton, null, BABYLON.Matrix.Identity());
const bone = new BABYLON.Bone('bone', quadMesh1.skeleton, boneROOT, BABYLON.Matrix.Identity());

```

> **[Babylon.js Playground](https://playground.babylonjs.com/#YM8MSS%234)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

---

<div class="post-metadata">

**Author:** ![Khanon](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/khanon/32/14980_2.png) [@Khanon](https://forum.babylonjs.com/u/Khanon)\
**Post date:** [November 15, 2024, 9:41am UTC](https://forum.babylonjs.com/t/bone-not-rotating-with-parent/54768/5 "2024-11-15T09:41:39Z")

</div>

That is!! Thanks so much!

---

<div class="post-metadata">

**Author:** ![Joe\_Kerr](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/joe_kerr/32/39017_2.png) [@Joe\_Kerr](https://forum.babylonjs.com/u/Joe_Kerr)\
**Post date:** [November 15, 2024, 10:20am UTC](https://forum.babylonjs.com/t/bone-not-rotating-with-parent/54768/6 "2024-11-15T10:20:17Z")

</div>

Why? The original PG **does** have a root bone (see Inspector).

Might there be a bug if the skeleton only has a single bone? [attachToBone](https://github.com/BabylonJS/Babylon.js/blob/38fc2c204ef82ce284219f81ba888b19c7bae245/packages/dev/core/src/Meshes/transformNode.ts#L895) looks innocent though 🤔

Maybe [here](https://github.com/BabylonJS/Babylon.js/blob/38fc2c204ef82ce284219f81ba888b19c7bae245/packages/dev/core/src/Meshes/transformNode.ts#L1206): if attachToBone was called, this path is taken in computeWorldMatrix. But then I get lost because bone.\_finalMatrix is never updated 😵‍💫

---

<div class="post-metadata">

**Author:** ![Tricotou](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tricotou/32/5844_2.png) [@Tricotou](https://forum.babylonjs.com/u/Tricotou)\
**Post date:** [November 15, 2024, 10:27am UTC](https://forum.babylonjs.com/t/bone-not-rotating-with-parent/54768/7 "2024-11-15T10:27:36Z")

</div>

> [@Joe\_Kerr](#):
>
> The original PG **does** have a root bone (see Inspector)

Yes, but here @Khanon wants to move a bone and attach a mesh to it, and in that case it should not be the root bone, I guess. I don’t have the exact answer to the “why ?” but I just notice that either BabylonJS or Blender, it’s always like so : root bone, and then you attach some transform bones to it 🙂 . I guess it’s a matter of hierarchy organisation / convention or something like that

---

<div class="post-metadata">

**Author:** ![Khanon](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/khanon/32/14980_2.png) [@Khanon](https://forum.babylonjs.com/u/Khanon)\
**Post date:** [November 16, 2024, 8:53pm UTC](https://forum.babylonjs.com/t/bone-not-rotating-with-parent/54768/8 "2024-11-16T20:53:17Z")

</div>

For some reason this is not working in my engine 😑  
I’m investigating but the structure seems to be the same than the PG.

![robot-rotation-ezgif.com-optimize](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/8/0/808e5b8e2b9766110421c7ce1649bdfe335b75dd.gif)

**PS:** Ok, I found it, the problem is using _billboardMode_ in the hat mesh, which is attached to the bone.

@Evgeni_Popov some idea if this is the desired behaviour or a bug?

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [November 18, 2024, 11:02am UTC](https://forum.babylonjs.com/t/bone-not-rotating-with-parent/54768/9 "2024-11-18T11:02:27Z")

</div>

I think it’s the expected behavior, but you can try to set `TransformNode.BillboardUseParentOrientation = true` and see if it fixes it.

---

<div class="post-metadata">

**Author:** ![Khanon](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/khanon/32/14980_2.png) [@Khanon](https://forum.babylonjs.com/u/Khanon)\
**Post date:** [November 18, 2024, 4:54pm UTC](https://forum.babylonjs.com/t/bone-not-rotating-with-parent/54768/10 "2024-11-18T16:54:29Z")

</div>

Yes, that works, anyway I’m unsetting the _billboardMode_ for the child.
