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
,AutoCloseable
,Comparable<JoltPhysicsObject>
Control the acceleration and balance of a motorcycle, in addition to its
acceleration and deceleration.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
enableLeanController
(boolean enable) Enable or disable the lean spring.void
enableLeanSteeringLimit
(boolean enable) Enable or disable the lean steering limit.float
Return the smoothing factor for the lean angle.float
Return the stiffness of the lean spring.float
Return the damping constant of the lean spring.float
Return the coefficient of the integral term.float
Return the decay rate of the integral term when the motorcycle is unsupported.float
Return the distance between the front and back wheels.boolean
Test whether the lean spring is enabled.boolean
Test whether the lean steering limit is enabled.void
setLeanSmoothingFactor
(float factor) Alter the smoothing factor for the lean angle.void
setLeanSpringConstant
(float constant) Alter the stiffness of the lean spring.void
setLeanSpringDamping
(float damping) Alter the damping constant of the lean spring.void
setLeanSpringIntegrationCoefficient
(float coefficient) Return the coefficient of the integral term.void
setLeanSpringIntegrationCoefficientDecay
(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, setRightInput
Methods inherited from class com.github.stephengold.joltjni.VehicleController
getConstraint
Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, va
-
Method Details
-
enableLeanController
public void enableLeanController(boolean enable) Enable or disable the lean spring.- Parameters:
enable
-true
to enable the spring,false
to disable it
-
enableLeanSteeringLimit
public void enableLeanSteeringLimit(boolean enable) Enable or disable the lean steering limit.- Parameters:
enable
-true
to limit steering based on speed,false
to 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:
true
if enabled, otherwisefalse
-
isLeanSteeringLimitEnabled
public boolean isLeanSteeringLimitEnabled()Test whether the lean steering limit is enabled. The vehicle controller is unaffected.- Returns:
true
if 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)
-