Given a Matrix4x4 instance, how can I extract the translation into a Vector3?
I am unsure as to how the TRS vector is composed, it would be useful if somebody would illustrate the structure of the matrix.
Given a Matrix4x4 instance, how can I extract the translation into a Vector3?
I am unsure as to how the TRS vector is composed, it would be useful if somebody would illustrate the structure of the matrix.
In 3D geometry, the acts of scaling, rotation and translation can be described as the elements in a 4x4 matrix. If a point (x,y,z) is treated as a 4x1 matrix with an imaginary extra value (called “w”) set to 1 … i.e. <x,y,z,1> … then multiplying the 4x4 matrix by the 4x1 point results in a new 4x1 point/matrix. The new 4x1 represents a new location which is the scale, rotation and translation as described by the 4x4.
So … getting to the punch line. If you have obtained a 4x4 matrix, it is possible this contains much more than just translation information and as such, isn’t a simple matter of “getting” the translation Vector3 out of it. The matrix could also contain rotation and scaling information as well.
You may find value in web sites such as this:
http://math.stackexchange.com/questions/336/why-are-3d-transformation-matrices-4x4-instead-of-3x3
Or other similar web sites.