Advertisement
MrsMcLead

Camera, Roll a Ball

Jan 31st, 2018
399
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.42 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class CameraController : MonoBehaviour {
  6.  
  7.     public GameObject ball;
  8.     private Vector3 offset;
  9.  
  10.     // Use this for initialization
  11.     void Start () {
  12.         offset = transform.position - ball.transform.position;
  13.     }
  14.    
  15.     // Update is called once per frame
  16.     void Update () {
  17.         transform.position = ball.transform.position + offset;
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement