Package com.github.stephengold.joltjni
Class MotorcycleController
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.NonCopyable
com.github.stephengold.joltjni.VehicleController
com.github.stephengold.joltjni.WheeledVehicleController
com.github.stephengold.joltjni.MotorcycleController
- All Implemented Interfaces:
ConstJoltPhysicsObject,ConstVehicleController,AutoCloseable,Comparable<JoltPhysicsObject>
Control the acceleration and balance of a motorcycle, in addition to its
acceleration and deceleration.
-
Method Summary
Modifier and TypeMethodDescriptionvoidenableLeanController(boolean enable) Enable or disable the lean spring.voidenableLeanSteeringLimit(boolean enable) Enable or disable the lean steering limit.floatReturn the smoothing factor for the lean angle.floatReturn the stiffness of the lean spring.floatReturn the damping constant of the lean spring.floatReturn the coefficient of the integral term.floatReturn the decay rate of the integral term when the motorcycle is unsupported.floatReturn the distance between the front and back wheels.booleanTest whether the lean spring is enabled.booleanTest whether the lean steering limit is enabled.voidsetLeanSmoothingFactor(float factor) Alter the smoothing factor for the lean angle.voidsetLeanSpringConstant(float constant) Alter the stiffness of the lean spring.voidsetLeanSpringDamping(float damping) Alter the damping constant of the lean spring.voidsetLeanSpringIntegrationCoefficient(float coefficient) Return the coefficient of the integral term.voidsetLeanSpringIntegrationCoefficientDecay(float decay) Alter the decay rate of the integral term when the motorcycle is unsupported.Methods inherited from class com.github.stephengold.joltjni.WheeledVehicleController
getBrakeInput, getDifferentials, getEngine, getForwardInput, getHandBrakeInput, getRightInput, getTransmission, setBrakeInput, setDifferentialLimitedSlipRatio, setDriverInput, setForwardInput, setHandBrakeInput, setRightInputMethods inherited from class com.github.stephengold.joltjni.VehicleController
getConstraint, getSettingsMethods 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
-
Method Details
-
enableLeanController
public void enableLeanController(boolean enable) Enable or disable the lean spring.- Parameters:
enable-trueto enable the spring,falseto disable it
-
enableLeanSteeringLimit
public void enableLeanSteeringLimit(boolean enable) Enable or disable the lean steering limit.- Parameters:
enable-trueto limit steering based on speed,falseto stop limiting it
-
getLeanSmoothingFactor
public float getLeanSmoothingFactor()Return the smoothing factor for the lean angle. The vehicle controller is unaffected.- Returns:
- the factor (0=no smoothing, 1=lean angle frozen)
-
getLeanSpringConstant
public float getLeanSpringConstant()Return the stiffness of the lean spring. The vehicle controller is unaffected.- Returns:
- the spring constant
-
getLeanSpringDamping
public float getLeanSpringDamping()Return the damping constant of the lean spring. The vehicle controller is unaffected.- Returns:
- the damping constant
-
getLeanSpringIntegrationCoefficient
public float getLeanSpringIntegrationCoefficient()Return the coefficient of the integral term. The vehicle controller is unaffected.- Returns:
- the force coefficient
-
getLeanSpringIntegrationCoefficientDecay
public float getLeanSpringIntegrationCoefficientDecay()Return the decay rate of the integral term when the motorcycle is unsupported. The vehicle controller is unaffected.- Returns:
- the rate (per second)
-
getWheelBase
public float getWheelBase()Return the distance between the front and back wheels. The vehicle controller is unaffected.- Returns:
- the distance (in meters)
-
isLeanControllerEnabled
public boolean isLeanControllerEnabled()Test whether the lean spring is enabled. The vehicle controller is unaffected.- Returns:
trueif enabled, otherwisefalse
-
isLeanSteeringLimitEnabled
public boolean isLeanSteeringLimitEnabled()Test whether the lean steering limit is enabled. The vehicle controller is unaffected.- Returns:
trueif enabled, otherwisefalse
-
setLeanSmoothingFactor
public void setLeanSmoothingFactor(float factor) Alter the smoothing factor for the lean angle.- Parameters:
factor- the desired smoothing factor (0=no smoothing, 1=lean angle frozen)
-
setLeanSpringConstant
public void setLeanSpringConstant(float constant) Alter the stiffness of the lean spring.- Parameters:
constant- the desired spring constant
-
setLeanSpringDamping
public void setLeanSpringDamping(float damping) Alter the damping constant of the lean spring.- Parameters:
damping- the desired damping constant
-
setLeanSpringIntegrationCoefficient
public void setLeanSpringIntegrationCoefficient(float coefficient) Return the coefficient of the integral term.- Parameters:
coefficient- the desired force coefficient
-
setLeanSpringIntegrationCoefficientDecay
public void setLeanSpringIntegrationCoefficientDecay(float decay) Alter the decay rate of the integral term when the motorcycle is unsupported.- Parameters:
decay- the desired rate (per second)
-