You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
487 B

using UnityEngine;
using System.Collections;
public class cameraController : MonoBehaviour {
public GameObject player;
//so we reference the player on the inspector
private Vector3 offset;
//so we can calculate distance between player and camera
void Start ()
{
offset = transform.position - player.transform.position;
}
void LateUpdate ()
//on lateUpdate because here goes the animation thingies ¿?
{
transform.position = player.transform.position + offset;
}
}