Time for action – controlling the camera

We will only need one, fairly short script to control and manage our camera:

  1. To start and to keep everything organized, create a new empty GameObject and name it CameraRig. Also, to keep it simple, set its position to zero on each axis.
  2. Next, create three more empty GameObject and name them LeftPoint, RightPoint, and TopPoint. Set their X axis positions to 5. Position the LeftPoint to be in front of the slingshot and at 3 on the Y axis. The RightPoint needs to be positioned in front of the pig structure you created. The TopPoint can be over the slingshot, but needs to set to 8 on the Y axis. These three points will define the limits of where our camera can move when being dragged and following birds.
  3. Make ...

Get Unity Android Game Development by Example Beginner's Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.