Game Development Reference
In-Depth Information
Quaternion quatPitch = CreateFromAx-
isAngle( left , totalPitch )
actualOffset = Transform( acutalOffset ,
quatPitch )
// Now construct the camera matrix
Vector3 eye = player . position + verticalOff-
set
Vector3 target = eye + actualOffset
// In this case we can just pass in world up,
since we can never
// rotate upside-down.
cameraMatrix = CreateLookAt( eye , target ,
Vector3 (0, 1, 0))
end
end
Spline Camera
Though the mathematical definition is a bit more specific, a spline can be thought
of as a curve that is defined by a series of points that lie on the curve. Splines are
popular in games because they enable an object to smoothly interpolate across the
curve over time. This can be very useful for cutscene cameras, because it means it
is possible to have a camera follow along a predefined spline path.
There are many different types of splines, but one of the simplest is the Catmull-
Rom spline. This type of spline enables interpolation between two adjacent points
provided there is a control point before and after the two active ones. For example,
in Figure 8.11 , P 1 and P 2 are the active control points (at t = 0 and t = 1, respect-
ively) and P 0 and P 3 are the control points prior to and after. Even though the fig-
ure shows only four points, there is no practical limit. As long as there is a control
point before and after, the path can go on indefinitely.
Search WWH ::




Custom Search