-
Notifications
You must be signed in to change notification settings - Fork 8
Transforms
Transforms are related to vectors/normals as in they are simply the X, Y, and Z (if 3D) coordinates of the normals of a given object.
So let’s say we have a 2D object and this is its transform matrix:
The X and Y rows that are colored red and green are the normals. And the X and Y columns that are gray are the X and Y position of those normals. The “Offset” column tells us how much to add to each axis after everything else is set.
Let’s look at it in visual form:
In this picture, the two normals are represented as a red and green arrow for the X and Y normal, respectively.
And the coordinates of the normals are shown as “X Normal: (1.0 , 0.0)” and “Y Normal: (0.0 , 1.0)”. The rows represent the “arrow”, or normals, and the columns represent the position of these normals.
The last column is the offset of all the normals together. So let’s say the matrix looked like this:
This is the same as the last image, but instead of the player being in the center of the scene, he is now 3 units to the right and 1 unit north, like this:
So when the offset number is in the X axis row, which in this example is “3.0”, that means we add “3.0” to all the normals. In Godot an objects transform matrix is in relation to its parent node.
One last example. When an object is rotated, what does the matrix look like? Let’s say the object is rotated 25 degrees clockwise. It would look like this:
And in visual form it would look like this:
In 3D we just add one extra row and column:
And it would look like this in 3D: