# Is TransformNode.computeWorldMatrix() broken?

**URL:** <https://forum.babylonjs.com/t/is-transformnode-computeworldmatrix-broken/38072>\
**Category:** Bugs\
**Tags:** transformnode\
**Created:** [February 9, 2023, 7:36pm UTC](https://forum.babylonjs.com/t/is-transformnode-computeworldmatrix-broken/38072 "2023-02-09T19:36:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![romaleks360](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/romaleks360/32/29836_2.png) [@romaleks360](https://forum.babylonjs.com/u/romaleks360)\
**Post date:** [February 9, 2023, 7:36pm UTC](https://forum.babylonjs.com/t/is-transformnode-computeworldmatrix-broken/38072/1 "2023-02-09T19:36:27Z")

</div>

Hi! I imported .glb avatar model and tried to set its bones world rotation.  
I am using bone().getTransformNode().computeWorldMatrix().invert() to create a world-to-local matrix. However, this matrix has some weird little offset.  
Here’s an example of a broken matrix. I am trying to put the avatar’s head in the world origin (0,0,0) using the method above, and the offset is there.

> **[Babylon.js Playground](https://www.babylonjs-playground.com/#WGZLGJ%237747)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

Am I missing something?

---

<div class="post-metadata">

**Author:** ![Michael\_Prosser](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/michael_prosser/32/6062_2.png) [@Michael\_Prosser](https://forum.babylonjs.com/u/Michael_Prosser)\
**Post date:** [February 9, 2023, 8:05pm UTC](https://forum.babylonjs.com/t/is-transformnode-computeworldmatrix-broken/38072/2 "2023-02-09T20:05:45Z")

</div>

Here is a fixed playground

> **[Babylon.js Playground](https://www.babylonjs-playground.com/#WGZLGJ%237750)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

Notice the rotationQuaternion on line 22. I noticed in the object the rotation was set at quaternion.

![Screen Shot 2023-02-09 at 11.59.46 AM](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/7/7/77de0cc14e3f44d6b101a8d4204027afd499f2db.png)

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [February 9, 2023, 8:37pm UTC](https://forum.babylonjs.com/t/is-transformnode-computeworldmatrix-broken/38072/3 "2023-02-09T20:37:18Z")

</div>

I would normally compute the required translation that I ll transfer in local space: [https://www.babylonjs-playground.com/#WGZLGJ#7753](https://www.babylonjs-playground.com/#WGZLGJ#7753)

---

<div class="post-metadata">

**Author:** ![romaleks360](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/romaleks360/32/29836_2.png) [@romaleks360](https://forum.babylonjs.com/u/romaleks360)\
**Post date:** [February 9, 2023, 8:42pm UTC](https://forum.babylonjs.com/t/is-transformnode-computeworldmatrix-broken/38072/4 "2023-02-09T20:42:03Z")

</div>

Oops, I thought that it would compensate the rotation for some reason… Just had a brain fart and totally forgot how does a matrix work. Anyway, thanks for the quick reply!

---

<div class="post-metadata">

**Author:** ![romaleks360](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/romaleks360/32/29836_2.png) [@romaleks360](https://forum.babylonjs.com/u/romaleks360)\
**Post date:** [February 9, 2023, 8:42pm UTC](https://forum.babylonjs.com/t/is-transformnode-computeworldmatrix-broken/38072/5 "2023-02-09T20:42:41Z")

</div>

thanks for the tip, really useful!
