Hello,here’s a thing,i have a ball that Controls by pressing arrow keys,now what i want is to make this ball move faster every couple seconds for example adding force to the ball by 4 every 5 seconds. Please help? This is my code so far.
#pragma strict
function Update () {
if (Input.GetKey ("up")) {
GetComponent.<Rigidbody>().AddForce (Vector3.forward * 4);
}
if (Input.GetKey ("down")) {
GetComponent.<Rigidbody>().AddForce (Vector3.back * 4);
}
if (Input.GetKey ("left")) {
GetComponent.<Rigidbody>().AddForce (Vector3.left * 4);
}
if (Input.GetKey ("right")) {
GetComponent.<Rigidbody>().AddForce (Vector3.right * 4);
}
}