Game Development Reference
In-Depth Information
practical purposes, in the scene that the artist built containing only the
model of the robot, world space is object space.
Back to advertising. Our
goal is to transform the vertices
of the model from their “home”
location to some new location
(in our case, into a make-believe
kitchen), according to the de-
sired position and orientation of
the robot based on the execu-
tive whims at that moment, as
shown in Figure 3.6.
Let's talk a bit about how
to accomplish this. We won't
get too far into the mathemati-
cal details—that's what the rest
of this chapter is for. Conceptu-
ally, to move the robot into po-
sition we first rotate her clock-
wise 120 o (or, as we'll learn in
Section 8.3, by “heading left
120 o ”). Then we translate 18 ft
east and 10 ft north, which ac-
cording, to our conventions, is
a 3D displacement of [18,0,10].
This is shown in Figure 3.7.
At this time, please allow
us a brief digression to answer
a question that some readers
may be asking: “Do we have
to rotate first, and then trans-
late?” The answer to this ques-
tion is basically “yes.” Al-
though it may seem more nat-
ural to translate before rotat-
ing, it's usually easier to rotate
first. Here's why. When we ro-
tate the object first, the center
of rotation is the origin. Rota-
tion about the origin and trans-
lation are two primitive tools we have at our disposal, and each is easy.
(Recall our motivation for introducing upright space in Section 3.2.4.) If
we rotate second, then that rotation will occur about a point that is not
Original
position
Step 1.
Rotate
Step 2.
Translate
Figure 3.7
Transforming the robot from object space to world
space by rotating, then translating
Search WWH ::




Custom Search