# Matrix Math Example

I have other more general questions about matrices and how/why we use them in Blender / AN but first can anyone please explain why in the example the object doesn't seem to have been translated by 3?

(Though I can quite clearly see the rotation translation)

The transformations are applied from right to left so, in this example, since the translation is the second input to the multiplication node, it will be the rightmost transformation. The following example assumes that your cube is centered at (0,0,0).

1. The object's origin is at (0,0,0) 1. Translation: the object is translated in the x axis by 3 units, so it's new origin is at (3,0,0) (at this point its orientation remains unchanged). 1. Rotation: now the object is rotated around the global Z axis, through the world's origin (0,0,0). i.e. the pivot point is (0,0,0), but the object starts at (3,0,0), so it moves on the circumference of a circle centered at (0,0,0) and of radius 3. Since the axis of rotation does not go through the center of the object, but through (0,0,0), the object is both translated and rotated. In the example below, the angle of rotation is 45 degrees. The animation node tree to implement this translate-first-rotate-second transformation could look like follows: Now, as an exercise, let's switch the order of transformations to see what happens.

1. Object rests at the origin (as before).
2. Rotate around the global Z axis by angle of 45 degrees. Object's origin remains at (0,0,0), but local X and Y axis are rotated by 45 degrees CCW. 1. Translate along the global X axis by 3 units. Origin is now at (3,0,0), and the local axis remain unchanged from step 2. The animation node tree in this case is almost identical, but for the switch of inputs of the first Math Node 