O'Reilly logo

Creating E-Learning Games with Unity by David Horachek

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 methods 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required