Advertisement
Guest User

Untitled

a guest
Jun 13th, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. private void ApplyForces()
  2. {
  3. if (tiresOnGround > 0 || airTime < 0.3f)
  4. {
  5. //stop sliding sideways//
  6. physicsRigidbody.AddForce(physicsBody.transform.right * WheelVelocity.x * -(tireGrip * 140f) *
  7. Time.fixedDeltaTime);
  8.  
  9. //downforce//
  10. if (downForce > 0)
  11. physicsRigidbody.AddForce(Vector3.down *
  12. (Mathf.Abs(WheelVelocity.z) * downForce * 0.1f *
  13. physicsRigidbody.velocity.magnitude) * Time.fixedDeltaTime);
  14. }
  15. else
  16. {
  17. if (airTime > 0.3f)
  18. {
  19. //increase gravity//
  20. physicsRigidbody.AddForce((Physics.gravity * physicsRigidbody.mass) * 2f);
  21. }
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement