Game Development Reference
In-Depth Information
being drawn, we can save effort by keeping track of only the location and
orientation of its object space in world space. It becomes necessary to
compute the world coordinates of its snout, tail, and right ear at only
certain times—for example, when it moves into view of the camera.
Since the object space moves around in world space, it is convenient
to view the world space as a “parent” space, and the object space as a
“child” space. It is also convenient to break objects into subobjects and
to animate them independently. A model decomposed into a hierarchy like
this is sometimes called an articulated model. For example, as the sheep
walks, its head swings back and forth and its ears flap up and down. In
the coordinate space of the sheep's head, the ears appear to be flapping
up and down—the motion is in the y-axis only and so is relatively easy
to understand and animate. In the sheep's coordinate space its head is
swinging from side to side along the sheep's x-axis, which is again rela-
tively easy to understand. Now, suppose that the sheep is moving along
the world's z-axis. Each of the three actions—ears flapping, head swinging,
and sheep moving forwards—involves a single axis and is easy to under-
stand in isolation from the others. The motion of the tip of the sheep's
right ear, however, traces a complicated path through the world coordinate
space, truly a nightmare for a programmer to compute from scratch. By
breaking the sheep into a hierarchically organized sequence of objects with
nested coordinate spaces, however, the motion can be computed in separate
components and combined relatively easily with linear algebra tools such
as matrices and vectors, as we see in later chapters.
For example, let's say we need to know the world coordinates of the tip
of the ear of the sheep. To compute these coordinates, we might first use
what we know about the relationship of the sheep's ear relative to its head
to compute the coordinates of that point in “head space.” Next, we use
the position and orientation of the head relative to the body to compute
the coordinates in “body space.” Finally, since we know the position and
orientation of the sheep's body relative to the world's origin and axes, we
can compute the coordinates in world space. The next few chapters go
deeper into the details of how to do this.
It's convenient to think of the sheep's coordinate space moving relative
to world space, the sheep's head coordinate space moving relative to the
sheep's space, and the sheep's ear space moving relative to the sheep's head
space. Thus we view the head space as a child of the sheep space, and the ear
space as a child of the head space. Object space can be divided into many
different subspaces at many different levels, depending on the complexity
of the object being animated. We can say that the child coordinate space
is nested in the parent coordinate space. This parent-child relationship
between coordinate spaces defines a hierarchy, or tree, of coordinate spaces.
The world coordinate space is the root of this tree. The nested coordinate
Search WWH ::




Custom Search