Beispiel #1
0
 // Moves car forward, checks if car is on air
 private void movesCarForward()
 {
     if (physicsAttributes.getOnGround())
     {
         carRigidBody.drag = physicsAttributes.dragToGround;
         if (Mathf.Abs(motor.getSpeedInput()) > 0)
         {
             carRigidBody.AddForce(transform.forward * motor.getSpeedInput());
         }
     }
     else
     {
         carRigidBody.drag = 0.1f;
         carRigidBody.AddForce(Vector3.up * -physicsAttributes.gravityForce * 100f);
     }
 }