Class VehicleAntiRollBar

java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.VehicleAntiRollBar
All Implemented Interfaces:
ConstJoltPhysicsObject, ConstVehicleAntiRollBar, AutoCloseable, Comparable<JoltPhysicsObject>

public class VehicleAntiRollBar extends JoltPhysicsObject implements ConstVehicleAntiRollBar
A spring that connects two wheels and reduces a vehicle's rolling motion.
  • Constructor Details

    • VehicleAntiRollBar

      public VehicleAntiRollBar()
      Instantiate a default bar.
    • VehicleAntiRollBar

      public VehicleAntiRollBar(ConstVehicleAntiRollBar original)
      Instantiate a copy of the specified settings.
      Parameters:
      original - the settings to copy (not null, unaffected)
  • Method Details

    • restoreBinaryState

      public void restoreBinaryState(StreamIn stream)
      Load settings from the specified binary stream.
      Parameters:
      stream - the stream to read from (not null)
    • setLeftWheel

      public VehicleAntiRollBar setLeftWheel(int wheelIndex)
      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

      public VehicleAntiRollBar setRightWheel(int wheelIndex)
      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

      public VehicleAntiRollBar setStiffness(float stiffness)
      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 interface ConstVehicleAntiRollBar
      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 interface ConstVehicleAntiRollBar
      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 interface ConstVehicleAntiRollBar
      Returns:
      the spring constant (in Newtons per meter)
    • saveBinaryState

      public void saveBinaryState(StreamOut stream)
      Save the bar to the specified binary stream. The bar is unaffected.
      Specified by:
      saveBinaryState in interface ConstVehicleAntiRollBar
      Parameters:
      stream - the stream to write to (not null)