-
Notifications
You must be signed in to change notification settings - Fork 0
/
CameraScr.cs
47 lines (42 loc) · 1.54 KB
/
CameraScr.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraScr : MonoBehaviour
{
public GameObject target;
public GameObject point;
public float minFoV = 15.0f;
public float maxFoV = 60.0f;
public float zoomDuration = 1.0f;
// public void zoomin(){
// StartCoroutine(ZoomIn());
// }
public void zoomout(){
transform.position = new Vector3(33.0f, 8.0f, 12.5f);
transform.rotation = Quaternion.Euler(2.0f, -135.5f, 0.0f);
Camera.main.fieldOfView = 60.0f;
}
// IEnumerator ZoomIn()
// {
// float startTime = Time.time;
// float startFoV = Camera.main.fieldOfView;
// float endFoV = minFoV;
// Vector3 startPosition = transform.position;
// Vector3 endPosition = point.transform.position;
// while (Time.time < startTime + (zoomDuration*1.0f))
// {
// float t = (Time.time - startTime) / (zoomDuration*1.0f);
// Camera.main.fieldOfView = Mathf.Lerp(startFoV, endFoV, t);
// transform.position = Vector3.Lerp(startPosition, endPosition, t);
// transform.LookAt(target.transform.position);
// yield return null;
// }
// Camera.main.fieldOfView = endFoV;
// transform.position = endPosition;
// }
public void zoomin(){
transform.position = point.transform.position;
transform.LookAt(target.transform.position);
Camera.main.fieldOfView = 15.0f;
}
}