Select Main Camera in Scene. We need to set it up and add a script to have it follow the character.
Update()
function we align the camera position with that of the character.What follows is the code for the script:
using UnityEngine; using System.Collections; public class CameraControl : MonoBehaviour { public int distance; private Transform follow; // Use this for initialization void Start () { follow = GameObject.Find("runner").GetComponent<Transform>(); } // Update is called once per frame void Update () { Vector3 v = new Vector3 (follow.position.x, follow.position.y, distance); transform.position = v; } }
-15
to begin with. Check out the following screenshot that illustrates this:This camera simply keeps the same character x and y, so the character itself is always at the center of the camera focus.
Please take into consideration that this script could be improved, for example, by allowing the player to look a bit ahead of the character before taking a leap. To delve more into the properties of Cameras in Unity, you can refer to the manual at http://docs.unity3d.com/Manual/class-Camera.html.
In case you didn't do it yet, we recommend you add a Directional light to your scene so materials will look better on screen. You should know how to do that: from the top menu, navigate to GameObject | Create Other | Directional Light, as shown in the following screenshot:
Now you can rotate the directional light using the gizmo as you see fit for your taste. Being a Directional Light, it will cast its rays independently from its actual position and distance from the character.
3.144.172.38