SHARE
TWEET

Untitled

a guest Aug 8th, 2017 2,964 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class Tracker : MonoBehaviour {
  6.  
  7.     public GameObject target;
  8.     public GameObject cam;
  9.  
  10.     public Vector2 camRange;
  11.  
  12.     // Use this for initialization
  13.     void Start () {
  14.        
  15.     }
  16.    
  17.     // Update is called once per frame
  18.     void Update () {
  19.         this.transform.position = Vector3.Lerp (this.transform.position, target.transform.position, 0.05f);
  20.         float d = Input.GetAxis ("Mouse ScrollWheel");
  21.         if (d > 0f) {
  22.             if(cam.GetComponent<Camera>().fieldOfView > camRange.x){
  23.                 cam.GetComponent<Camera> ().fieldOfView -= 2;
  24.             }
  25.         } else if(d < 0f) {
  26.             if(cam.GetComponent<Camera>().fieldOfView < camRange.y){
  27.                 cam.GetComponent<Camera> ().fieldOfView += 2;
  28.             }
  29.         }
  30.     }
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top