void FixedUpdate() { if (Input.GetButtonUp(buttonHover) && currentSpeed == 0.0f) { ToggleHoverMode(); } if (kartStatus.GetKartMode() == KartMode.Kart) { currentSpeed = Mathf.Round(2 * Mathf.PI * Colliders.RL.radius * Colliders.RL.rpm * 60 / 1000); power = Input.GetAxis(axisVertical) * enginePower * Time.deltaTime * speedModifier; float speedFactor = rigidbody.velocity.magnitude / maxSteerSpeed; steer = Mathf.Lerp(lowSpeedSteerAngle, highSpeedSteerAngle, speedFactor); steer *= Input.GetAxis(axisHorizontal); //steer = Input.GetAxis("Horizontal") * maxSteer; brake = Input.GetButton(buttonBrake) ? rigidbody.mass * 0.1f : 0.0f; Colliders.FL.steerAngle = steer; Colliders.FR.steerAngle = steer; Brake(); } else // hovercraft { HoverMode(); } }
void OnTriggerEnter(Collider other) { if (other.gameObject.name == "Mine") { if (!shieldEnabled && kartStatus.GetKartMode() == KartMode.Kart) { Instantiate(Explosion, other.transform.position, other.transform.rotation); rigidbody.AddExplosionForce(500000.0f, other.transform.position, 30.0f, 5.0f); rigidbody.AddTorque(Vector3.up * 10000000.0f); } } }