From 141034d698116bea36d38566e45df4acce2a94b8 Mon Sep 17 00:00:00 2001 From: weiliwu2 <weiliwu2@illinois.edu> Date: Tue, 23 Oct 2018 00:38:18 -0500 Subject: [PATCH] Upload New File --- CameraController.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 CameraController.cs diff --git a/CameraController.cs b/CameraController.cs new file mode 100644 index 0000000..332316a --- /dev/null +++ b/CameraController.cs @@ -0,0 +1,19 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class CameraController : MonoBehaviour { + + public GameObject player; + private Vector3 offset; + + // Use this for initialization + void Start () { + offset = transform.position - player.transform.position; + } + + // Update is called once per frame + void LateUpdate () { + transform.position = player.transform.position + offset; + } +} -- GitLab