Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var ForwardSpeed = 10;
  2. var KeyDown = false;
  3.  
  4. function FixedUpdate () {
  5.      rigidbody.AddRelativeForce (ForwardSpeed, 0, 0);
  6. }
  7.  
  8. function Update () {
  9.     KeyDown = Input.anyKey;
  10.  
  11.     if (Input.GetKey(yourForwardKey))
  12.     {
  13.         ForwardSpeed = 10;
  14.     }
  15.  
  16.     if(KeyDown = false)
  17.     {
  18.         ForwardSpeed = 0;
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement