Advertisement
Guest User

Untitled

a guest
Jan 21st, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. float currentHorFieldSpeed = 0;
  2.  
  3. const float speedRatio = 15f;
  4. float speed = Input.acceleration.x;
  5. float direction = Input.acceleration.z > 0 ? -1 : 1;
  6. bool isIdle = (Mathf.Abs(speed) - 0.07f) <= 0f;
  7. if (!isIdle)
  8. currentHorBatSpeed = speed * speedRatio*direction;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement