Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var ForwardSpeed = 10;
- var KeyDown = false;
- function FixedUpdate () {
- rigidbody.AddRelativeForce (ForwardSpeed, 0, 0);
- }
- function Update () {
- KeyDown = Input.anyKey;
- if (Input.GetKey(yourForwardKey))
- {
- ForwardSpeed = 10;
- }
- if(KeyDown = false)
- {
- ForwardSpeed = 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement