Package com.github.stephengold.joltjni
Class VehicleAntiRollBar
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.VehicleAntiRollBar
- All Implemented Interfaces:
ConstJoltPhysicsObject,ConstVehicleAntiRollBar,AutoCloseable,Comparable<JoltPhysicsObject>
A spring that connects two wheels and reduces a vehicle's rolling motion.
-
Constructor Summary
ConstructorsConstructorDescriptionInstantiate a default bar.VehicleAntiRollBar(ConstVehicleAntiRollBar original) Instantiate a copy of the specified settings. -
Method Summary
Modifier and TypeMethodDescriptionintReturn the index of the left wheel.intReturn the index of the right wheel.floatReturn the stiffness of the bar.voidrestoreBinaryState(StreamIn stream) Load settings from the specified binary stream.voidsaveBinaryState(StreamOut stream) Save the bar to the specified binary stream.setLeftWheel(int wheelIndex) Alter the index of the left wheel.setRightWheel(int wheelIndex) Alter the index of the right wheel.setStiffness(float stiffness) Alter the stiffness of the bar.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
-
VehicleAntiRollBar
public VehicleAntiRollBar()Instantiate a default bar. -
VehicleAntiRollBar
Instantiate a copy of the specified settings.- Parameters:
original- the settings to copy (notnull, unaffected)
-
-
Method Details
-
restoreBinaryState
Load settings from the specified binary stream.- Parameters:
stream- the stream to read from (not null)
-
setLeftWheel
Alter the index of the left wheel. (native attribute: mLeftWheel)- Parameters:
wheelIndex- the index of the desired wheel (default=0)- Returns:
- the modified settings, for chaining
-
setRightWheel
Alter the index of the right wheel. (native attribute: mRightWheel)- Parameters:
wheelIndex- the index of the desired wheel (default=1)- Returns:
- the modified settings, for chaining
-
setStiffness
Alter the stiffness of the bar. (native attribute: mStiffness)- Parameters:
stiffness- the desired spring constant (in Newtons per meter, default=1000)- Returns:
- the modified settings, for chaining
-
getLeftWheel
public int getLeftWheel()Return the index of the left wheel. The bar is unaffected. (native attribute: mLeftWheel)- Specified by:
getLeftWheelin interfaceConstVehicleAntiRollBar- Returns:
- the index of the wheel
-
getRightWheel
public int getRightWheel()Return the index of the right wheel. The bar is unaffected. (native attribute: mRightWheel)- Specified by:
getRightWheelin interfaceConstVehicleAntiRollBar- Returns:
- the index of the wheel
-
getStiffness
public float getStiffness()Return the stiffness of the bar. The bar is unaffected. (native attribute: mStiffness)- Specified by:
getStiffnessin interfaceConstVehicleAntiRollBar- Returns:
- the spring constant (in Newtons per meter)
-
saveBinaryState
Save the bar to the specified binary stream. The bar is unaffected.- Specified by:
saveBinaryStatein interfaceConstVehicleAntiRollBar- Parameters:
stream- the stream to write to (not null)
-