Sunday, March 27, 2011

Sliding Platform Code

var movingbox: GameObject;
var isup = true;


function Update () {
movingbox.rigidbody.transform.Translate(Vector3.left * 2* Time.deltaTime);
if (isup ==false){
movingbox.rigidbody.transform.rotation.y += 360;
}
if (isup ==true){
movingbox.rigidbody.transform.rotation.y = 0;
}
if (movingbox.rigidbody.transform.position.x<=251.73){
isup=false;
}
if (movingbox.rigidbody.transform.position.x>=256.31){
isup=true;
}
}

No comments:

Post a Comment