CHAPTER 2 ■ SETTING UP DIFFERENT CAMERA MODES IN YOUR 3D WORLD
50
The QuakeCamera Class
Because it isoftenquiteusefultohaveafirst-personcameramodereadilyavailable,Ihave
separated the code from this chapter into a class. This class is used as the camera in many of
the 3D examples found elsewhere in this book and is easy to integrate into one of your own
projects.
2-4. Create a Freelancer-Style Camera:
Full 3D Rotation Using Quaternions
The Problem
You want to create a camera that is able to rotate in every possible way, for example, to cre-
ate a flight game. You will need rotations around three axes to do this, but because of Gimbal
lock (each rotation has an impact on the other rotations), this becomes very difficult, if not