Mercurial > hg > Game > Games
diff Chapter5/Assets/SimpleCloudSystem by RM/SCS.js @ 2:fdab88fc2cb9
add game projects
author | Yuta ANSE <e135745@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 17 Jul 2015 23:14:45 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Chapter5/Assets/SimpleCloudSystem by RM/SCS.js Fri Jul 17 23:14:45 2015 +0900 @@ -0,0 +1,34 @@ + +var Player : Transform; +var CloudsSpeed: float; +private var distance = 10.0; + +private var height = 0; +private var heightDamping = 0; +private var rotationDamping = 0; + + + +function Update() { + transform.Rotate(0,Time.deltaTime*CloudsSpeed ,0); + // rotate 90 degrees around the object's local Y axis: + } + +function LateUpdate () { + + + + if (!Player) + return; + + var wantedHeight = Player.position.y + height; + + var currentHeight = transform.position.y; + + currentHeight = Mathf.Lerp (currentHeight, wantedHeight, heightDamping * Time.deltaTime); + + transform.position = Player.position; + + transform.position.y = currentHeight; + +} \ No newline at end of file