In general, game engines deal a lot with geometry. Everything like point, vector, line or 3D model can be represented as a set of Coordinates. Each Coordinate must be related to some Coordinate Grid.
Usual Coordinate Grid is represented by its origin (starting point) and a set of axis.
Unity supports two types of Coordinate Grids (also called Spaces):
- World – single for the whole scene with the fixed origin bound to the scene center.
- Local – one per each object within the scene but with the origin bound to the object pivot.
Very often it is required to transform a coordinate from one space to another. To do this operation Unity provides a set of methods:
The first 3 methods do a transformation from the local space to the world space and the last 3 do the opposite operation. The reason why there is not only one method but a set is following: different types of transformation can be dependent on different factors like rotation, position or scale of the coordinate’s owner (the owner of the local space). The documentation for each method is quite short but the transformations behind are not so trivial.
The goal of this set of articles is a detailed explanation with illustrations of each transformation. This should give a clear understanding of each method and allow to do a wise choice during development.
For better comprehension, the explanation of all three transformation types is divided into parts: one for each type. Current post is about TransformDirection method 1 .