Time for action – controlling the camera
We will only need one, fairly short script to control and manage our camera:
- 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. - Next, create three more empty GameObject and name them
LeftPoint
,RightPoint
, andTopPoint
. Set their X axis positions to5
. Position theLeftPoint
to be in front of the slingshot and at3
on the Y axis. TheRightPoint
needs to be positioned in front of thepig
structure you created. TheTopPoint
can be over the slingshot, but needs to set to8
on the Y axis. These three points will define the limits of where our camera can move when being dragged and following birds. - Make ...
Get Unity Android Game Development by Example Beginner's Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.