-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMoveUp.cs
49 lines (36 loc) · 1.03 KB
/
MoveUp.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
48
49
using UnityEngine;
using System.Collections;
public class MoveUp : MonoBehaviour {
public GameObject GvrMain;
//Start
private Vector3 startPos;
//End
private Vector3 endPos;
//Distance
private float distance = 200f;
public bool moveForward;
// public float toggleAngle = 30.0f;
//public Transform vrCamera;
//Time to take from start to end
private float lerpTime = 5;
//This will update the lerp time
private float currentLerpTime = 0;
// Use this for initialization
void Start () {
startPos = GvrMain.transform.position;
endPos = GvrMain.transform.position + Vector3.up * distance;
}
// Update is called once per frame
void Update () {
}
public void Transform()
{
currentLerpTime += Time.deltaTime;
if (currentLerpTime >= lerpTime)
{
currentLerpTime = lerpTime;
}
float Perc = currentLerpTime / lerpTime;
GvrMain.transform.position = Vector3.Lerp(startPos, endPos, Perc);
}
}