Package com.github.stephengold.joltjni
Class WheeledVehicleController
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.NonCopyable
com.github.stephengold.joltjni.VehicleController
com.github.stephengold.joltjni.WheeledVehicleController
- All Implemented Interfaces:
ConstJoltPhysicsObject,ConstVehicleController,AutoCloseable,Comparable<JoltPhysicsObject>
- Direct Known Subclasses:
MotorcycleController
Control the acceleration and deceleration of a wheeled vehicle.
-
Method Summary
Modifier and TypeMethodDescriptionfloatReturn how strongly the brake pedal is pressed.Access the vehicle's differentials.Access the vehicle's engine.floatReturn the forward acceleration.floatReturn how strongly the hand brake is pulled.floatReturn the steering angle.Access the vehicle's transmission.voidsetBrakeInput(float pressure) Alter how strongly the brake pedal is pressed.voidsetDifferentialLimitedSlipRatio(float ratio) Alter the wheel-speed ratio of each differential, measured at the clutch.voidsetDriverInput(float forward, float right, float brake, float handBrake) Update the control inputs from the vehicle's driver.voidsetForwardInput(float forward) Alter the forward acceleration.voidsetHandBrakeInput(float pressure) Alter how strongly the hand brake is pulled.voidsetRightInput(float right) Alter the steering amount.Methods 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
-
getBrakeInput
public float getBrakeInput()Return how strongly the brake pedal is pressed. The controller is unaffected. (native member: mBrakeInput)- Returns:
- the value (≥0, ≤1)
-
getDifferentials
Access the vehicle's differentials.- Returns:
- a new array of JVM objects, each with a pre-existing native object assigned
-
getEngine
Access the vehicle's engine.- Returns:
- a new JVM object with the pre-existing native object assigned
-
getForwardInput
public float getForwardInput()Return the forward acceleration. The controller is unaffected. (native field: mForwardInput)- Returns:
- the value (≥-1, ≤1)
-
getHandBrakeInput
public float getHandBrakeInput()Return how strongly the hand brake is pulled. The controller is unaffected. (native field: mHandBrakeInput)- Returns:
- the value (≥0, ≤1)
-
getRightInput
public float getRightInput()Return the steering angle. The controller is unaffected. (native member: mRightInput)- Returns:
- the steering angle (≥-1, ≤1, right=1)
-
getTransmission
Access the vehicle's transmission.- Returns:
- a new JVM object with the pre-existing native object assigned
-
setBrakeInput
public void setBrakeInput(float pressure) Alter how strongly the brake pedal is pressed. (native member: mBrakeInput)- Parameters:
pressure- the desired pressure (≥0, ≤1, default=0)
-
setDifferentialLimitedSlipRatio
public void setDifferentialLimitedSlipRatio(float ratio) Alter the wheel-speed ratio of each differential, measured at the clutch. (native member: mDifferentialLimitedSlipRatio)- Parameters:
ratio- the desired ratio (>0)
-
setDriverInput
public void setDriverInput(float forward, float right, float brake, float handBrake) Update the control inputs from the vehicle's driver.- Parameters:
forward- the desired driving direction and amount of acceleration (≥-1, ≤1)right- the desired steering angle (≥-1, ≤1)brake- the desired main brake pressure (≥0, ≤1)handBrake- the desired amount of hand braking (≥0, ≤1)
-
setForwardInput
public void setForwardInput(float forward) Alter the forward acceleration. (native member: mForwardInput)- Parameters:
forward- the desired driving direction and accelerator pedal pressure (≥-1, ≤1, default=0)
-
setHandBrakeInput
public void setHandBrakeInput(float pressure) Alter how strongly the hand brake is pulled. (native member: mHandBrakeInput)- Parameters:
pressure- the desired pressure (≥0, ≤1, default=0)
-
setRightInput
public void setRightInput(float right) Alter the steering amount. (native member: mRightInput)- Parameters:
right- the desired steering amount (≥-1, ≤1, default=0, right=1)
-