Class VehicleTransmission

All Implemented Interfaces:
ConstJoltPhysicsObject, AutoCloseable, Comparable<JoltPhysicsObject>

public class VehicleTransmission extends VehicleTransmissionSettings
The transmission (gearbox) of a VehicleController.
  • Method Details

    • allowSleep

      public boolean allowSleep()
      Test whether to allow sleeping only when the transmission is idle.
      Returns:
      true if allowed, otherwise false
    • getClutchFriction

      public float getClutchFriction()
      Return how friction the clutch gives. The settings are unaffected.
      Returns:
      the amount of friction (≥0, ≤1, 1=full friction)
    • getCurrentGear

      public int getCurrentGear()
      Return the current gear.
      Returns:
      the gear number (-1=reverse, 0=neutral, 1=1st gear)
    • getCurrentRatio

      public float getCurrentRatio()
      Return transmission ratio based on the current gear. The settings are unaffected.
      Returns:
      the ratio between engine and differential
    • isSwitchingGear

      public boolean isSwitchingGear()
      Test whether the transmission is currently switching gears.
      Returns:
      true if switching, otherwise false
    • set

      public void set(int currentGear, float clutchFriction)
      Alter the input from the driver (only relevant in manual mode).
      Parameters:
      currentGear - the selected gear (-1=reverse, 0=neutral, 1=1st gear)
      clutchFriction - the amount of clutch friction (0=none, 1=full friction)
    • update

      public void update(float deltaTime, float rpm, float forwardInput, boolean canShiftUp)
      Update the gear and clutch friction if the transmission is in auto mode.
      Parameters:
      deltaTime - the time step (in seconds, ≥0)
      rpm - the engine's current rate (in revolutions per minute)
      forwardInput - positive if the driver wants to go forward, otherwise negative
      canShiftUp - true if the driver wants to upshift, otherwise false