Some time ago I wrote this answer (back on Unity Answers). It was actually more about the Camera’s projection matrix but it turned into a general matrix crash course. I mirrored the article on github.
Like it was already explained, we use homogeneous coordinates in order to actually represent translation with a matrix. Usually in “normal” linear algebra vectors always sit with their tail at the origin. Those basics are prefectly explained in the essence of linear algebra series by 3blue1brown(Grant Sanderson).
If your goal is to understand how homogeneous coordinate work it’s easier to step down one dimension as homogeneous coordinates add an additional dimension and everything takes place in a hyper plane that is offset by 1 unit in this extra dimension. This offset allows us to use a shear operation in a higher dimension to represent a translation in the lower dimensions. As I said it’s easier to understand when you think about 2d space. In 2d space we would use a 3x3 matrix to represent rotation, scaling and translation. So when the x-y plane is our actual coordinate space, we will add a 3rd dimension and offset the whole 2d plane by 1 unit in that new z direction. Now when you do a shear operation, the whole 2d plane will appear to move around. The same concept transfers to higher dimensions. Though it’s a bit harder to visualize it in your head ![]()
Besides allowing transformation matrices to perform translations, we also need this extra dimension for our projection matrix to construct a perspective view. That’s what my article was mainly about. There’s a lot of material out there on the internet on those topics. Though the question is how deep you want to dive into it. As others have already said, you usually do not manually tinker with matrices in Unity. In Unity we have the Transform component which encapsulates a local transformation matrix as well as a matrix hierarchy based on the parent Transforms. The Transform component stores the components separately (Quaternion for localRotation and two Vector3 for localScale and localPosition). In also provides the position and rotation properties which directly calculate the world space result or allow setting it. Those a quite tedious calculations when you have to do the bookeeping yourself.