Class VehicleDifferentialSettings

java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.VehicleDifferentialSettings
All Implemented Interfaces:
ConstJoltPhysicsObject, ConstVehicleDifferentialSettings, AutoCloseable, Comparable<JoltPhysicsObject>

public class VehicleDifferentialSettings extends JoltPhysicsObject implements ConstVehicleDifferentialSettings
Settings used to configure the differential of a WheeledVehicleController.
  • Constructor Details

    • VehicleDifferentialSettings

      public VehicleDifferentialSettings()
      Instantiate default settings.
    • VehicleDifferentialSettings

      public VehicleDifferentialSettings(ConstVehicleDifferentialSettings original)
      Instantiate a copy of the specified settings.
      Parameters:
      original - the settings to copy (not null, unaffected)
  • Method Details

    • set

      public void set(ConstVehicleDifferentialSettings source)
      Copy the argument to the current settings.
      Parameters:
      source - the settings to copy (not null, unaffected)
    • setDifferentialRatio

      public void setDifferentialRatio(float ratio)
      Alter the number of gearbox rotations per wheel rotation. (native attribute: mDifferentialRatio)
      Parameters:
      ratio - the desired ratio (default=3.42)
    • setEngineTorqueRatio

      public float setEngineTorqueRatio(float fraction)
      Alter the fraction of the engine's torque that is applied to this differential. (native attribute: mEngineTorqueRatio)
      Parameters:
      fraction - the desired ratio (default=1)
      Returns:
      the fraction, for chaining TODO return void
    • setLeftRightSplit

      public void setLeftRightSplit(float rightFraction)
      Alter the fraction of the engine's torque that is applied to the right wheel. (native attribute: mLeftRightSplit)
      Parameters:
      rightFraction - the desired fraction (all left=0, all right=1, default=0.5)
    • setLeftWheel

      public void setLeftWheel(int wheelIndex)
      Alter which left wheel is assigned to the differential. (native attribute: mLeftWheel)
      Parameters:
      wheelIndex - the index of the wheel (≥0) or -1 for none (default=-1)
    • setLimitedSlipRatio

      public void setLimitedSlipRatio(float ratio)
      Alter the ratio of maximum wheel speed to minimum wheel speed. When this ratio is exceeded, all torque gets distributed to the slowest wheel. (native member: mLimitedSlipRatio)
      Parameters:
      ratio - the desired ratio (>1, FLT_MAX for an open differential, default=1.4)
    • setRightWheel

      public void setRightWheel(int wheelIndex)
      Alter which right wheel is assigned to the differential. (native attribute: mRightWheel)
      Parameters:
      wheelIndex - the index of the wheel (≥0) or -1 for none (default=-1)
    • getDifferentialRatio

      public float getDifferentialRatio()
      Return the number of gearbox rotations per wheel rotation. The settings are unaffected. (native attribute: mDifferentialRatio)
      Specified by:
      getDifferentialRatio in interface ConstVehicleDifferentialSettings
      Returns:
      the ratio
    • getEngineTorqueRatio

      public float getEngineTorqueRatio()
      Return the fraction of the engine's torque that is applied to this differential. The settings are unaffected. (native attribute: mEngineTorqueRatio)
      Specified by:
      getEngineTorqueRatio in interface ConstVehicleDifferentialSettings
      Returns:
      the fraction
    • getLeftRightSplit

      public float getLeftRightSplit()
      Return the fraction of the engine's torque that is applied to the right wheel. The settings are unaffected. (native attribute: mLeftRightSplit)
      Specified by:
      getLeftRightSplit in interface ConstVehicleDifferentialSettings
      Returns:
      the desired fraction (all left=0, all right=1)
    • getLeftWheel

      public int getLeftWheel()
      Return the index of the left wheel. The settings are unaffected. (native attribute: mLeftWheel)
      Specified by:
      getLeftWheel in interface ConstVehicleDifferentialSettings
      Returns:
      the index of the wheel (≥0) or -1 for none
    • getLimitedSlipRatio

      public float getLimitedSlipRatio()
      Return the ratio of maximum wheel speed to minimum wheel speed. The settings are unaffected. (native member: mLimitedSlipRatio)
      Specified by:
      getLimitedSlipRatio in interface ConstVehicleDifferentialSettings
      Returns:
      the ratio (>1, FLT_MAX for an open differential)
    • getRightWheel

      public int getRightWheel()
      Return the index of the right wheel. The settings are unaffected. (native attribute: mRightWheel)
      Specified by:
      getRightWheel in interface ConstVehicleDifferentialSettings
      Returns:
      the index of the wheel (≥0) or -1 for none