Game Development Reference
In-Depth Information
matrix has the property that its inverse equals its transpose. This is
useful later in section 12.2.1.2.
Figure 12.1: The camera vectors defining the
position and orientation of the camera rela-
tive to the world
With these four vectors describing the camera, we would like our cam-
era to be able to perform the following six operations:
Rotate around the right vector (pitch)
Rotate around the up vector (yaw)
Rotate around the look vector (roll)
Strafe along the right vector
Fly along the up vector
Move along the look vector
Through these six operations, we are able to move along three axes
and rotate around three axes, giving us a flexible six degrees of free-
dom. The following Camera class definition reflects our description of
data and desired methods:
class Camera
{
public:
enum CameraType { LANDOBJECT, AIRCRAFT };
Camera();
Camera(CameraType cameraType);
~Camera();
void strafe(float units); // left/right
void fly(float units);
// up/down
void walk(float units);
// forward/backward
void pitch(float angle);
// rotate on right vector
void yaw(float angle);
// rotate on up vector
void roll(float angle);
// rotate on look vector
 
Search WWH ::




Custom Search