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 TypeMethodDescriptionint
Return the index of the left wheel.int
Return the index of the right wheel.float
Return the stiffness of the bar.void
restoreBinaryState
(StreamIn stream) Load settings from the specified binary stream.void
saveBinaryState
(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, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, va
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Comparable
compareTo
Methods 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:
getLeftWheel
in 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:
getRightWheel
in 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:
getStiffness
in interfaceConstVehicleAntiRollBar
- Returns:
- the spring constant (in Newtons per meter)
-
saveBinaryState
Save the bar to the specified binary stream. The bar is unaffected.- Specified by:
saveBinaryState
in interfaceConstVehicleAntiRollBar
- Parameters:
stream
- the stream to write to (not null)
-