Eriknem

Unity2

Oct 20th, 2016
285
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class CameraController : MonoBehaviour {
  5.  
  6.     public GameObject player;
  7.  
  8.     private Vector3 offset;
  9.  
  10.     void Start ()
  11.     {
  12.         offset = transform.position - player.transform.position;
  13.     }
  14.    
  15.     void LateUpdate ()
  16.     {
  17.         transform.position = player.transform.position + offset;
  18.     }
  19. }
RAW Paste Data