I tried inputting a bone’s absolute matrix’s rotation quaternion into its bone.setRotationQuaternion() method with the parameter BABYLON.Space.WORLD, however the skeleton and mesh become messed up

I thought that a bone’s (1) absolute matrix’s rotation quaternion and (2) world rotation quaternion are the same, so I expected that setting one to the other would have no effect, though it looks like I’m wrong.

Please see the Youtube video below where I uncomment lines in the PG linked below:

Does anyone know the relationship between the (1) world rotation quaternion and (2) absolute matrix rotation? I’m trying to find the correct input quaternion for bone.setRotationQuaternion() with BABYLON.Space.WORLD.

You are missing a multiplication of the first row by a scaling value, which is +1 or -1 depending on the bind matrix determinant. From _updateAbsoluteBindMatrices:

@Evgeni_Popov thank you for your tip on the scaling determinant. I’ve tried looking online to understand this term more, though haven’t found anything yet. Would you have any pointers on where I could read more on the scaling determinant’s purpose in the bone’s world rotation?

Unfortunately, I don’t really understand this part of our bone code, so I can’t really help…

From what I understand, it takes into account the fact that the matrix could be “left”/“right” handed (as we do for meshes coming from gltf files), and negate the X axis of the matrix (the first row) - we also negate scaling.x for the root bone in gltf case.