Game Development Reference
In-Depth Information
Illustration 34:
Glass ball that serves as player character
To control the ball, we create
BallRoller
script. We also add
ObjectTracker
script to the main
camera to make it follow the ball. Listing 24 shows
BallRoller
control script, and Listing
25 shows
ObjectTracker
script for the camera. Remember to assign the ball game object to
objectToTrack
variable in
ObjectTracker
to tell the camera which object it must track.