Eriknem

Unity2

Oct 20th, 2016
611
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.37 KB | None | 0 0
  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. }
Add Comment
Please, Sign In to add comment