Game Development Reference
In-Depth Information
body axes, we do fixed-axis rotations, where the rotations are about the
upright axes. This means we actually do the rotations in the reverse order:
first bank, then pitch, and finally heading. See Section 8.3.2 if you don't
remember what fixed-axis rotations are.
In summary, the generation of the object-to-upright rotation matrix is
a straightforward concatenation of three simple rotation matrices,
M object→upright = BPH ,
where B , P , and H are the rotation matrices for bank, pitch, and heading,
which rotate about the z-, x-, and y-axes, respectively. We learned how to
compute these elementary rotation matrices in Section 5.1.2.
2
4
3
5
cosb sinb 0
− sinb cosb 0
0
Elementary rotation
matrices for bank, pitch,
and heading
B = R z (b) =
,
0
1
2
3
1
0
0
4
5
P = R x (p) =
0
cosp sinp
,
0
− sinp cosp
2
3
cosh 0
− sinh
4
5
H = R y (h) =
0
1
0
.
sinh 0
cosh
Putting it all together (and leaving out the messy math to actually do
the matrix multiplications), we have
M object→upright = BPH
Object-to-upright
rotation matrix from
Euler angles
2
3
chcb + shspsb sbcp −shcb + chspsb
−chsb + shspcb cbcp sbsh + chspcb
shcp
, (8.14)
4
5
=
−sp
chcp
where we have introduced the shorthand notation
ch = cosh,
cp = cosp,
cb = cosb,
sh = sinh,
sp = sinp,
sb = sinb.
To rotate vectors from upright space to object space, we will use the
inverse of this object-to-upright matrix. We know that since a rotation
matrix is orthogonal, the inverse is simply the transpose. However, let's
verify this.
To visualize the upright-to-object transform, we imagine the undoing
the fixed-axis rotations. We first undo the heading, and then the pitch,
Search WWH ::




Custom Search