Game Development Reference
In-Depth Information
Figure 3.11 Lerp from a to b with different f values.
Coordinate Systems
Not all games use the same 3D coordinate system. Some coordinate systems may
have the y-axis as up, whereas others may use the z-axis. Some might be right-
handed coordinate systems while others might be left-handed. Selection of a co-
ordinate system is arbitrary and often comes down to personal preference. Most
games seem to prefer systems where the y-axis is up and the z-axis goes into or
out of the screen, but there is no mathematical basis for this preference.
Because there is no one set way to express a 3D system, whenever you're working
with a new framework it is important to check which coordinate system it uses.
It ultimately doesn't matter which coordinate system a game uses, as long as it's
consistent across the codebase (see the sidebar “ A Coordinate System Mix-Up
for a humorous instance where this wasn't the case).
Sometimes it may be a requirement to convert from one coordinate system to an-
other. A common occurrence of this is when a 3D modeling program uses a differ-
ent coordinate system than the game itself. Converting from one coordinate sys-
tem to another may require negating a component or swapping components. It just
depends on what the two coordinate systems are. For example, Figure 3.12 shows
twoy-upcoordinatesystems:aright-handedoneandaleft-handedone.Inthispar-
ticular case, the conversion is relatively simple: To switch from one to the other,
just negate the z-component.
Search WWH ::




Custom Search