2
|
1
|
|
2 var Player : Transform;
|
|
3 var CloudsSpeed: float;
|
|
4 private var distance = 10.0;
|
|
5
|
|
6 private var height = 0;
|
|
7 private var heightDamping = 0;
|
|
8 private var rotationDamping = 0;
|
|
9
|
|
10
|
|
11
|
|
12 function Update() {
|
|
13 transform.Rotate(0,Time.deltaTime*CloudsSpeed ,0);
|
|
14 // rotate 90 degrees around the object's local Y axis:
|
|
15 }
|
|
16
|
|
17 function LateUpdate () {
|
|
18
|
|
19
|
|
20
|
|
21 if (!Player)
|
|
22 return;
|
|
23
|
|
24 var wantedHeight = Player.position.y + height;
|
|
25
|
|
26 var currentHeight = transform.position.y;
|
|
27
|
|
28 currentHeight = Mathf.Lerp (currentHeight, wantedHeight, heightDamping * Time.deltaTime);
|
|
29
|
|
30 transform.position = Player.position;
|
|
31
|
|
32 transform.position.y = currentHeight;
|
|
33
|
|
34 } |