Inverse, although is generally seen as getting the reciprocal of each matrix, is more commonly just a transposition, which is what Roblox does.
A transposition is basically flipping it diagonally, or over the identity.
ie.
[1, 0, 1)
(0, 1, 1)
(0, 0, 1]
becomes
[1, 0, 0)
(0, 1, 0)
(1, 1, 1]
A nice way to do this is:
for A = 1, 3 do
for B = 1, 3 do
local temp = Matrix[A][B]
Matrix[A][B] = Matrix[B][A]
Matrix[B][A] = temp
end
end
and it's important to note that a matrix multiplied by its inverse is always the identity
|