Package com.github.stephengold.joltjni
Class VehicleDifferentialSettings
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.VehicleDifferentialSettings
- All Implemented Interfaces:
ConstJoltPhysicsObject,AutoCloseable,Comparable<JoltPhysicsObject>
Settings used to configure the differential of a
WheeledVehicleController.-
Constructor Summary
ConstructorsConstructorDescriptionInstantiate default settings.Instantiate a copy of the specified settings. -
Method Summary
Modifier and TypeMethodDescriptionfloatReturn the number of gearbox rotations per wheel rotation.floatReturn the fraction of the engine's torque that is applied to this differential.intReturn the index of the left wheel.floatReturn the ratio of maximum wheel speed to minimum wheel speed.intReturn the index of the right wheel.voidsetDifferentialRatio(float ratio) Alter the number of gearbox rotations per wheel rotation.floatsetEngineTorqueRatio(float fraction) Alter the fraction of the engine's torque that is applied to this differential.voidsetLeftWheel(int wheelIndex) Alter which left wheel is assigned to the differential.voidsetLimitedSlipRatio(float ratio) Alter the ratio of maximum wheel speed to minimum wheel speed.voidsetRightWheel(int wheelIndex) Alter which right wheel is assigned to the differential.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, isCleanerStarted, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, va
-
Constructor Details
-
VehicleDifferentialSettings
public VehicleDifferentialSettings()Instantiate default settings. -
VehicleDifferentialSettings
Instantiate a copy of the specified settings.- Parameters:
original- the settings to copy (notnull, unaffected)
-
-
Method Details
-
getDifferentialRatio
public float getDifferentialRatio()Return the number of gearbox rotations per wheel rotation. The settings are unaffected. (native attribute: mDifferentialRatio)- 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)- Returns:
- the fraction
-
getLeftWheel
public int getLeftWheel()Return the index of the left wheel. The settings are unaffected. (native attribute: mLeftWheel)- 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)- Returns:
- the ratio (>1,
FLT_MAXfor an open differential)
-
getRightWheel
public int getRightWheel()Return the index of the right wheel. The settings are unaffected. (native attribute: mRightWheel)- Returns:
- the index of the wheel (≥0) or -1 for none
-
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
-
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_MAXfor 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)
-