Oh I hadn't seen the answer.. This is the Code:
#pragma strict
var amount = 5.0;
function Update()
{
if (Input.GetKey(KeyCode.R)) {
rigidbody.AddForce(transform.right * amount);
}
else if (Input.GetKey(KeyCode.T)) {
rigidbody.AddForce(-transform.right * amount);
}
else if (Input.GetKey(KeyCode.Y)) {
rigidbody.velocity = rigidbody.velocity * 0.9;
}
}
↧