Game Engine Architecture

(Ben Green) #1

4.3. Matrices 161


coordinates. The unit basis vector along this axis will be denoted L or R,
as appropriate.
The mapping between the (front, up, left ) labels and the (x, y, z) axes is com-
pletely arbitrary. A common choice when working with right-handed axes is
to assign the label front to the positive z-axis, the label left to the positive x-axis,
and the label up to the positive y-axis (or in terms of unit basis vectors, F = k,
L = i, and U = j). However, it’s equally common for +x to be front and +z to be
right (F = i, R = k, U = j). I’ve also worked with engines in which the z-axis is
oriented vertically. The only real requirement is that you stick to one conven-
tion consistently throughout your engine.
As an example of how intuitive axis names can reduce confusion, consid-
er Euler angles (pitch, yaw, roll), which are oft en used to describe an aircraft ’s
orientation. It’s not possible to defi ne pitch, yaw, and roll angles in terms of
the (i, j, k) basis vectors because their orientation is arbitrary. However, we can
defi ne pitch, yaw, and roll in terms of the (L, U, F) basis vectors, because their
orientations are clearly defi ned. Specifi cally,


z pitch is rotation about L or R,
z yaw is rotation about U, and
z roll is rotation about F.

4.3.9.2. World Space


World space is a fi xed coordinate space, in which the positions, orientations,
and scales of all objects in the game world are expressed. This coordinate
space ties all the individual objects together into a cohesive virtual world.
The location of the world-space origin is arbitrary, but it is oft en placed
near the center of the playable game space to minimize the reduction in fl oat-
ing-point precision that can occur when (x, y, z) coordinates grow very large.
Likewise, the orientation of the x-, y-, and z-axes is arbitrary, although most


le

front

up

Figure 4.17. One possible choice of the model-space front, left and up axis basis vectors for
an airplane.

Free download pdf