Pre-defined navigation techniques
Many of the problems associated with camera collision can be
avoided by pre-computation of potential camera movement or by using pre-defined
assistance based on knowledge of the environment (whether defined explicitly by
the camera designer or otherwise automatically pre-calculated).
Camera
navigation pre-computation may take many forms, usually at a cost of both
memory overhead and time to compute the allowable camera positions, although
the latter is not generally as important. Pre-computation typically has an
advantage in lower processor overhead during run-time.
Assistance for
navigation is often in the form of game script objects placed by designers and
therefore tailored to the specific requirements of both game play and
environmental concerns. Chapter 6 discusses scripting and its application to
camera motion and positioning; however, it is possible to derive navigation
assistance information from other game objects than those specifically designed
to control camera behavior.
There are a variety of ways in which both types of information may be used to
assist camera navigation and collision avoidance. Many of these schemes share
common ground with AI or robotic research techniques, and the bibliography
outlines some of the relevant papers.
Some of the more common solutions are as follows.
Pre-defined paths
The most common solution for pre-computation is to literally store entire
motion paths. Several games have used this effectively since it also allows
complete control over camera position (and possibly orientation), irrespective
or directly according to player action. Nevertheless, path motion can be
somewhat restrictive and could potentially result in the player experiencing a
sensation of lack of control.
Conversely, the ability to directly specify the
position of the camera is a boon when dealing with motion through a complex
environment, especially if the determination of the position can be varied
according to player position or action. A full description of path-based camera
motion may be found starting with the section Path in Chapter 7.
Path motion behaviors
Although the camera may be constrained by using a path to completely define its
motion, the interpretation of how the spline actually constrains the motion
offers several alternatives.
- Constrained path
camera. A constrained path camera is one that moves
precisely along a defined path within the game world. The camera is
typically not allowed to leave this path under any circumstance, unless
the path is no longer active. This is one of the most typical uses of path
cameras, so the camera position may be absolutely controlled to avoid
collision or interpenetration with environmental features, and so forth.
Non-interactive movies are often driven by this type of camera (as well as
stationary or slaved position cameras).
- Follow path camera.
In many cases, the motion of a camera on a constrained path may not appear
as "organic" or "natural" as required by the game
designers, even though the motion along the path may be smooth. However,
we may still wish to restrict camera motion in some fashion. A follow
path camera provides a mechanism to both restrict camera motion yet
allow some variance. In this case, the path only dictates a desired
position -- how the camera reaches that desired position can be defined in
a number of different ways -- i.e., the camera is not locked directly to
the path.
This may be likened to a "carrot" being dangled in front of the
camera. The camera will seek to the location defined by the current
evaluation of the path, but is allowed to move in a direct line toward
that position (note that this same technique may be applied regardless of
the position determination method).
Alternatively, we can use rules to
control the distance away from the desired path that the camera is allowed
to move; for example, the path now becomes a tube (typically cylindrical)
although the cross section may not be circular (e.g., ellipsoidal or
rectangular). Indeed, information about the shape of the path volume
may be contained within the knots themselves to allow for variance of
camera motion along the path (including the radius of the tube).
Another approach is to use a parametric curve with the input parameter as
the position of the camera along the path. These methods allow local
control over the camera without having multiple paths. When restricting
the motion of the camera away from the follow path, it is normally best
not to use "hard" constraints as this will likely lead to
unwanted motion artifacts. A damped spring or attractor/repulsor
may be used to provide a more analog response to the distance restriction.
Pre-defined volumes
Camera motion may also be restricted such that the camera is confined by the
extents of a pre-defined volume. The actual definition of the volume is
somewhat variable. It may consist of a simple convex shape such as a sphere,
cylinder, ellipsoid, or cube. Alternatively it may be derived from a complex
collision mesh, much as would other game entities.
Complex shapes, of course,
make navigation a more difficult proposition. The desired position within the
volume may be defined in a number of different ways. Clearly, we can use the
same techniques as mentioned earlier in this chapter regarding player
character-relative positions with the additional constraint of remaining within
the volume.
This approach is applicable to most of the dynamic determination methods, so
that the pre-defined volume constraint is applied after the initial
determination has been made. It is typically easier to use fixed dimension
volumes, but these could be varied according to game play requirements; for example,
the position of the player relative to a reference frame.
In the same manner as
path behaviors, directly constraining the camera position may lead to
non-continuous motion and often benefits from the use of forces or damped
springs to keep the camera within the volume.
|