Is TransformNode.computeWorldMatrix() broken?

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.

Am I missing something?

Here is a fixed playground

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

2 Likes

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

2 Likes

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!

thanks for the tip, really useful!