CFrame
and Vector3
are both matrices, but they have a different number of rows and columns. A CFrame
is 4x4 matrix and a Vector3
is a 3x1 matrix. According to the standard rules of matrix multiplication, you can only multiply a matrix by another matrix if they have either the same number of rows or the same number of columns (or both). This is where I start to question CFrame's ability to do multiplication with Vector3
. Since they have an unequal amount of rows and an unequal amount of columns, I still wonder how they are able to perform multiplication with each other. Maybe it's because Vector3
is, well, a vector, but I still don't know.
local new_mtrx = script.Parent.Base.Position * script.Parent.Joint1.Position
But CFrame
is a bit unusual with this. Even though its number of rows and columns is not the same as Vector3's, it can still multiply itself by a Vector3
and evaluate to a Vector3
:
local new_vctr = script.Parent.CFrame * script.Parent.Base.Position
And this evaluates to a Vector3
. So, my question is:
CFrame
able to multiply itself by a Vector3
, and why does it evaluate to a Vector3
instead of throwing an error?Like this. The 4x4 matrix can be multiplied with a 3x1. The top left is the cframe matrix multiplied by the 3x1 vector matrix on the right.