- Home /

# How to get translation from 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.

**Answer** by kolban
·
Apr 12, 2012 at 02:21 AM

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. ... 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.

### Your answer

### Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.

### Follow this Question

### Related Questions

how to create an inverse-TRS matrix directly? 0 Answers

InverseTransformPoint via Matrices? 2 Answers

I want to create an interactive right analog MouseLook? 0 Answers

How can I translate a Vector2 control system to Vector3 and rotate? 1 Answer

Different between transform.Translate() and Vector3.MoveTowards? 1 Answer