Coordinate system

From Stunts Wiki
Revision as of 00:34, 24 March 2025 by Cas (talk | contribs)

The topic of coordinate systems is a non-trivial matter to take into account with Stunts and tools designed for it. Usually, the difference between right-handed and left-handed coordinate systems is brought as an example of how these can differ, but in reality, very seldom we'll come across a left-handed coordinate system in 3D games and tools, as the standard is very strong on favouring its right-handed counterpart.

In contrast, viewport-oriented vs. cartography-oriented coordinates do deserve a closer look, as they're both very commonly used and offer their own convenience or justifications based on practical fact as well as philosophical reasons.

Viewport-oriented coordinates

This is a model by which Z is always used to refer to depth with the other coordinates accommodating to this fundamental rule. With these coordinate systems, chirality will dictate what the other axes should represent. For a right-handed coordinate system, X is typically set to grow from left to right and stand for the horizontal axis; Y will therefore have to grow from bottom to top and Z will have no choice but to grow from far to near, resulting in distance becoming a negative magnitude. This is often undesired, but we necessarily have to invert another axis to also invert this one. The alternative is to use a left-handed system, but this is almost always frowned upon much more strongly than having an inverted Z, so viewport-oriented coordinate systems will pretty much every time follow the pattern first described.

Apart from the loss of intuitiveness in the direction of growth of the axes, there is generally no difficulty in implementing this type of coordinate system in 3D environments in which all coordinates are equivalent, such as in space simulators. However, when one of the coordinates plays a slightly different role, such as when gravity comes into play, there is the inconvenience that the middle coordinate Y is of a different nature, so vertical projections into 2D, which tend to be the most common, require that we skip this middle coordinate and the resulting points have the awkward form (X, -Z) instead of the nice (X, Y) one would expect generally for 2D.

Viewport-oriented coordinates are the system used internally by Stunts. It is common in other 3D games, such as Minecraft, even though it also exhibits a fixed and aligned gravity field. The OBJ file format that Stressed and CarWorks can import for 3D shapes follows this structure as well.

See also