In 4x4 matrices, the values of the last row are usually the position, however in blender, when scripting returns 0, even though when i display the matrix on the console, the values are shown properly (Even applying the matrix to the object)

Here's what i do in the code

tfm = node.properties.transform
dec = tfm.decompose()

decompose() returns 3 values, which are the position, rotation, and scale:

<Matrix 4x4 ( 0.9962,  0.0000, -0.0872, 0.0000)
            (-0.0000,  1.0000, -0.0000, 0.0000)
            ( 0.0872,  0.0000,  0.9962, 0.0000)
            ( 9.6625, 12.2470, 55.6297, 1.0000)>

(Vector((0.0, 0.0, 0.0)), 
Quaternion((0.9990482330322266, 7.4434889363317325e-09, -0.04361938312649727, -3.249897295720672e-10)), 
Vector((1.0, 1.0, 1.0)))

These are the results after decomposing, which is what is applied to the object in blender when i do:

obj.matrix_world = tfm

However, even though the object rotates, it does not move.

A workaroud for this is applying the position is this way:

obj.location = (tfm[3][0],tfm[3][1],tfm[3][2])

However i should not be doing this and i would like to straight up apply the matrix and get all the values properly. Am i using the wrong method? Or maybe library? I think i'm not getting the proper values, even scale and rotation wise.

  • 2
    $\begingroup$ Looks like you have a transposed matrix if you are expecting row 3 (instead of column 3) to be the location. $\endgroup$
    – batFINGER
    Nov 1, 2016 at 7:18

1 Answer 1


As batFINGER said, the problem was that blender uses the matrices via rows instead columns, so i had to do the following to get the stuff right:

Doing this would fix it:


  • 1
    $\begingroup$ I found this really helpful - thanks for taking the time to update. I think it's fine for you to click 'accept' on your own answer. That way when people are looking for an answer like this in a list, it will be flagged as answered. $\endgroup$
    – uhoh
    Nov 1, 2016 at 11:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .