Advertisement
Munchy2007

BuggyUpdate

Mar 16th, 2016
21,169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.45 KB | None | 0 0
  1. void Update()
  2.   {
  3.         // Main Thrust
  4.         thrust = 0.0f;
  5.         float acceleration = Input.GetAxis("Vertical");
  6.         if (acceleration > deadZone)
  7.             thrust = acceleration * forwardAcceleration;
  8.         else if (acceleration < -deadZone)
  9.             thrust = acceleration * reverseAcceleration;
  10.  
  11.         // Turning
  12.         turnValue = 0.0f;
  13.         float turnAxis = Input.GetAxis("Horizontal");
  14.         if (Mathf.Abs(turnAxis) > deadZone)
  15.             turnValue = turnAxis;
  16.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement