Game Development Reference
In-Depth Information
// Camera forward is FROM eye TO target
Vector3 cameraForward = tPos - eye
cameraForward .Normalize()
// Cross products to calculate camera left, then
camera up
Vector3 cameraLeft = CrossProduct( tUp , camer-
aForward )
cameraLeft .Normalize()
Vector3 cameraUp = CrossProduct( cameraForward ,
cameraLeft )
cameraUp .Normalize()
// CreateLookAt parameters are eye, target, and
up
return CreateLookAt( eye , tPos , cameraUp )
end
Althoughthebasicfollowcamerawillworktotrackthetargetaroundintheworld,
it will seem very rigid. There is no give to it because it always stays at the same
distance from the target. When turning, the basic follow behavior makes it hard
to tell whether it's the object turning or the world turning around the object. Fur-
thermore, it may be difficult to get a sense of speed because the distance doesn't
vary at all based on the speed the object is travelling. For all of these reasons, this
basic follow camera is rarely used “as is” in games. Although it provides a simple
solution, the aesthetics of it are not quite there.
One simple addition that will improve the sense of speed is to make the horizontal
follow distance a function of the speed the target is travelling. So perhaps at rest
the horizontal follow distance could be 100 units, but when the target is travel-
ling at full speed, the horizontal follow distance could increase to 200. This simple
change will fix the sense of speed with the basic follow camera, but won't fix the
overall stiffness.
Search WWH ::




Custom Search