Game Development Reference
In-Depth Information
shown in Figure 3.3 . World space (on the left) is transformed into upright
space (in the center) by translating the origin. To transform upright space
into object space, we rotate the axes until they align with the object-space
axes. In this example, the robot thinks that her y-axis points from her feet
to her head and that her x-axis points to her left. 3
We will return to this
concept in Section 3.3.
The term “upright” is of our own invention and is not (yet!) a standard
you are likely to find elsewhere. But it's a powerful concept in search of a
good name. In physics, the term “center of mass coordinates” is sometimes
used to describe coordinates expressed in the space that we are calling up-
right space. In the first edition of this topic, we used the term “inertial
space” to refer to this space, but we have changed it to avoid confusion
with inertial reference frames in physics, which have some similar connota-
tions but are different. We'll have a bit more philosophical pleas regarding
upright space at the end of this chapter.
3.3
Basis Vectors and Coordinate Space
Transformations
We said that a major justification for the existence of more than one coor-
dinate space is because certain positions or directions are known only in a
particular coordinate space. Likewise, sometimes certain questions can be
answered only in particular coordinate spaces. When the question is best
asked in one space, and the information we need in order to answer that
question is known in a different space, we have a problem to solve.
For example, suppose that our robot is attempting to pick up a herring
sandwich in our virtual world. We initially know the position of the sand-
wich and the position of the robot in world coordinates. World coordinates
can be used to answer questions like “Is the sandwich north or south of
me?” A different set of questions could be answered if we knew the po-
sition of the sandwich in the object space of the robot—for example, “Is
the sandwich in front of me or behind me?” “Which way should I turn to
face the sandwich?” “Which way do I move my herring sandwich scoop
to get in position to pick up the sandwich?” Notice that to decide how to
manipulate the gears and circuits, the object-space coordinates are the rel-
3 Please forgive us for turning the robot around to face you, which caused us to break
from our usual conventions where +x is “right” in object space. In our defense, this
is a 2D diagram, and we're not really sure if people living in a flat world would have
any concept of “front” and “back” (though they would probably be able to tell between
“regular” and “reflected” states—just as in 3D we have left- and right-handed coordinate
systems). So who's to say if a 2D robot is really facing away from you or towards you,
or which direction she thinks is her left or right?
 
Search WWH ::




Custom Search