Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float currentHorFieldSpeed = 0;
- const float speedRatio = 15f;
- float speed = Input.acceleration.x;
- float direction = Input.acceleration.z > 0 ? -1 : 1;
- bool isIdle = (Mathf.Abs(speed) - 0.07f) <= 0f;
- if (!isIdle)
- currentHorBatSpeed = speed * speedRatio*direction;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement