Book Image

OUYA Game Development by Example

By : John Donovan
Book Image

OUYA Game Development by Example

By: John Donovan

Overview of this book

The OUYA console and development kit gives you the power to publish video games for the players, creating a console marketplace of the gamers, for the gamers, and by the gamers. Using the OUYA developer kit and the Unity3D game engine, even beginners with a captivating game idea can bring it to life with a hint of imagination. OUYA Game Development by Example uses a series of feature-based, step-by-step tutorials that teach beginners how to integrate essential elements into a game engine and then combine them to form a polished gaming experience.
Table of Contents (18 chapters)
OUYA Game Development by Example Beginner's Guide
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – creating a following third-person camera


A large portion of games use some variant of a following third-person camera, including marble-rolling games like the one we've been using as an example. These cameras typically follow the target around while maintaining a set distance and elevation.

First, we'll need to disable our current camera code, and then we can create a new script for our new camera code. Perform the following steps to create the camera:

  1. Click on the Main Camera object in the Hierarchy window to display its properties in the Inspector window.

  2. Uncheck the box next to the Tracking Camera component to disable it.

    Disabled components are still present on objects, but they don't function as long as the checkbox is empty as shown in the following screenshot:

  3. Create a new script called ThirdPersonCamera.cs in your Code folder, attach it to the Main Camera object in the Hierarchy window, and open it in your code editor.

    The first thing we'll add to the camera is a function...