Package com.github.stephengold.joltjni
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 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.floatReturn the fraction of the engine's torque that is applied to the right wheel.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.voidset(ConstVehicleDifferentialSettings source) Copy the argument to the current settings.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.voidsetLeftRightSplit(float rightFraction) Alter the fraction of the engine's torque that is applied to the right wheel.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, vaMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface com.github.stephengold.joltjni.readonly.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, targetVa
-
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
-
set
Copy the argument to the current settings.- Parameters:
source- the settings to copy (notnull, 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_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)
-
getDifferentialRatio
public float getDifferentialRatio()Return the number of gearbox rotations per wheel rotation. The settings are unaffected. (native attribute: mDifferentialRatio)- Specified by:
getDifferentialRatioin interfaceConstVehicleDifferentialSettings- 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:
getEngineTorqueRatioin interfaceConstVehicleDifferentialSettings- 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:
getLeftRightSplitin interfaceConstVehicleDifferentialSettings- 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:
getLeftWheelin interfaceConstVehicleDifferentialSettings- 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:
getLimitedSlipRatioin interfaceConstVehicleDifferentialSettings- 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)- Specified by:
getRightWheelin interfaceConstVehicleDifferentialSettings- Returns:
- the index of the wheel (≥0) or -1 for none
-