Game Development Reference
In-Depth Information
else{
c.goCloser(-dv);
}
}
else{
c.moveForward(dv);
}
}
If the camera object is of the
OrbitCamera
type, then invoke
goCloser
or
goFarther
,
otherwise invoke the
moveForward
function of
FreeCamera
.
Summary
In this chapter, we discussed the most important aspects of 3D rendering: the view
and projection matrices. We created our own camera class to compute the view
matrix from the up, left, direction, and position vectors. We demonstrated that
in a simple concept, that for each camera operation, such as
moveForward
, yaw,
pitch, and roll, the orthogonal vectors are affected and the logic to adjust these
vectors depends on the type of camera we implement. We demonstrated this fact by
implementing the free and orbit cameras.
We also discussed the projection matrix and implemented a perspective camera.
In the next chapter, we will discuss animations. We will apply animations on our
objects and also discuss the different algorithms to generate the movement trajectory
of the objects. We will use our
camera
class as a first person camera to follow moving
objects in our game scene.