Game Development Reference
In-Depth Information
Extending the GameCam script
The GameCam script's logic needs to be extended for this mission to support the ability
to look up in the sky and back down at the player. To do this, a couple of simple meth-
ods need to be added to adjust the lookat GameObject.
A public method named LookUp will find the object named lookUpTarget and swap
the lookObj in the script with the following code snippet:
public void LookUp()
{
GameObject go =
GameObject.Find("lookupTarget");
if (go)
lookObj = go;
}
Note
lookUpTarget is an empty GameObject parented to the player, placed 100 units
above him or her in Y —a simple and effective way of looking up above the player.
A second method, named LookPlayer , will restore the lookObj back to the player
object. This resets the camera back to third person functionality as shown in the fol-
lowing code snippet:
public void LookPlayer()
{
if (trackObj)
lookObj = trackObj;
}
Search WWH ::




Custom Search