Game Development Reference
the circle. Mathematically we do this by forcing its magnitude to be 1, by normalizing
If we built a 2D game using vectors to represent orientations, we'd need to occa-
sionally make sure that the orientations still lie on the circle by normalizing them.
Let's summarize these steps (not surprisingly we'll see them again later). We
started with problems of bounds-checking, which led us to use a representation with
one more degree of freedom that needed an extra constraint; in turn this led us to
add in an extra step to enforce the constraint.
A NGULAR S PEED
When we look at the angular speed of an object (sometimes called its “rotation”), we
don't have any of the problems we saw for orientation. An angular speed of 4 π radians
per second is different from 2 π radians per second. Every angular speed, expressed as
a single scalar value, is unique. The mathematics for angular speed is simple, so we
don't need bounds-checking and special-case code. This in turn means we don't need
to use a vector representation and we can stick with our scalar value.
T HE O RIGIN AND THE C ENTER OF M ASS
Before we leave two dimensions, it is worth considering what our position and ori-
entation represent. When we were dealing with particles, the position represented the
location of the particle. Particles by definition exist only at a single point in space,
even though in this topic we've stretched the definition slightly and treated them like
The Origin of an Object
If we have a larger object, what does the position represent? The object is at many
locations at the same time: it covers some extended area.
The position represents some preagreed location on the object that doesn't
change. It is sometimes called the “origin” of the object. In a game we might choose
the root of the spine of a character or the center of the chassis of a car. The position
doesn't need to be inside the object at all. Many developers represent the position of
a character as a location between the character's heels resting on the ground.
As long as the location doesn't move around the object, we can always determine
where every bit of the object will be from just its position and orientation. Locations
on the object are given relative to the origin of the object. If the origin of a car is in
the center of its chassis, as shown in figure 9.3, then its right headlight might be at a
1 . 5
0 . 75