Game Development Reference
In-Depth Information
A sample project using animation curves for camera movement
can be found in the topic's companion iles (code bundle) inside
the
Camera_Anim_Curves
folder of this chapter.
To use the
CameraMover
class, attach the script to a camera, and from the Object
Inspector, click on each of the
X
,
Y
, and
Z
curve fields to plot the distance and speed
of the camera over time. By clicking on a
Graph
swatch, you can edit the graph, thus
adding points and defining a motion curve to apply for that axis. Notice that the
X
,
Y
, and
Z
motion is plotted to the object's local axes (forward, up, and right) and
not to the world axes (
x
,
y
, and
z
). This allows the object motion to apply relatively
that offers you root-level control of object motion while honoring the relevance of
animation data, as shown here:
Plotting motion curves using animation curves