Converting external application Matrix to blender matrix

this is what all 4x4 matrices look like, unfortunately it doesn’t tell us anything, and the Lua code doesn’t make any sense to me since a 4x4 matrix should have 16 values and yours has 12. I’m guessing they’re actually using some bastardized 4x3 matrix and omitting the bottom row? Either way, I’ll leave that part up to you to figure out. What I can give you is more information about Blender’s matrices that may help you accomplish your goals.

Blender’s 4x4 matrix are composed as follows:

the top-left 3x3 values are the rotation component.
the cartesian direction vectors can be extracted using the first three columns (right, forward, and up- in that order).
the fourth column is the position component
the four values diagonal from top left to bottom right represent scaling, and as such they overlap the rotation components.

so as an example- if you wanted to get the position of a matrix, you could create a vector this way:
location = Vector((matrix[0][3], matrix[1][3], matrix[2][3]))

the up vector (+Z axis in Blender) would be:
up_vec = Vector((matrix[0][2], matrix[1][2], matrix[2][2])).normalized()

remember that scaling is done on the diagonal, so if the matrix is scaled direction vectors need to be normalized.

Once you’re able to figure out how Roblox’s matrices are composed, you should be able to use that information to compose a compatible matrix you can use to multiply against your camera’s transform during export.

2 Likes