Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Tracker : MonoBehaviour {
- public GameObject target;
- public GameObject cam;
- public Vector2 camRange;
- // Use this for initialization
- void Start () {
- }
- // Update is called once per frame
- void Update () {
- this.transform.position = Vector3.Lerp (this.transform.position, target.transform.position, 0.05f);
- float d = Input.GetAxis ("Mouse ScrollWheel");
- if (d > 0f) {
- if(cam.GetComponent<Camera>().fieldOfView > camRange.x){
- cam.GetComponent<Camera> ().fieldOfView -= 2;
- }
- } else if(d < 0f) {
- if(cam.GetComponent<Camera>().fieldOfView < camRange.y){
- cam.GetComponent<Camera> ().fieldOfView += 2;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement