Game Development Reference
In-Depth Information
Fig 2.22 A simple gyroscope.
(a) Gimbals and rotation points;
(b) attaching the gyroscope to
a plane; (c) a clockwise yaw
of the plane forces the first
gimbal to move with it, as it is
attached and has no freedom
of movement in that direction,
while the second gimbal is
free to move in response in the
opposite direction; (d) a 90°
yaw will cause the first and
second gimbals to align, thereby
entering a state of locked; and (e)
after the first and second gimbals
become locked, a pitch will retain
the integrity of the third gimbal.
(f ) However, a roll can cause
erratic behavior from gimbal 3.
y
1st gimbal
rotates around x axis
2nd gimbal
rotates around y axis
und y axis
y
3rd gimbal
rotates around y axis
orientation
plate
(b)
Gyroscope attached to plane
x
z
(a)
1st gimbal rotates
with plane
1st and 2nd gimbal
are aligned:
(locked)
2nd gimbal rotates
anticlockwise
plane yaws 90 degrees
clockwise
plane yaws clockwise
(c)
(d)
plane pitches
plane rolls
gyroscope
locked
gyroscope
reorientates
(e)
(f)
Quaternions to the Rescue
Quaternions are mathematical constructs that allow for rotations around the
three axes to be calculated all at once in contrast to Euler angles, which are
calculated one after the other. A quaternion has x , y , and z components, as
well as a rotation value.
In games using Euler angles, rotations can cause erratic orientations of
objects. This is illustrated in Figure 2.23 where the rotations of two planes are
compared. Each plane is rotated continually around the x , y , and z axes by
Search Nedrilad ::




Custom Search