Game Development Reference
In-Depth Information
Figure 23 - Euler angles, yaw, pitch and roll.
Euler angles are useful in some situations but their use needs to be carefully controlled as
they can result in a condition called gimbal lock which occurs when we lose a degree of
freedom.
1.3.8.1 Gimbal Lock
Gimballockisthelossofonedegreeoffreedomthathappenswhentwooftherotation axes
become parallel, this “locks” the rotation into an unrecoverable state where the rotation is
only possible along two axes.
A solution to avoid gimbal lock is to represent rotations using matrices or quaternions,
these rotation representations are numerically more stable.
1.3.9 Quaternions
Quaternions seem to inspire fear in many programmers; they are perceived as these wildly
complex mathematical entities that appear to be so difficult to comprehend, it is best to
avoid them entirely. The problem may stem from the way quaternions are usually presen-
ted, the fact is most programmers in a game team will not be tasked with implementing a
high performance math library. The majority of programmers will be the client of an exist-
ing library, either some in-house library or as part of some existing game engine like Unity
or Unreal. So rather than focusing on how quaternions work on the inside (which is not as
scaryasitseems!),wewillfocusonhowtousequaternionsandwhatwecandowiththem.
Search WWH ::




Custom Search