Class VehicleConstraintRef

All Implemented Interfaces:
ConstConstraint, ConstJoltPhysicsObject, ConstVehicleConstraint, AutoCloseable, Comparable<JoltPhysicsObject>

public final class VehicleConstraintRef extends Ref implements ConstVehicleConstraint
A counted reference to a VehicleConstraint. (native type: Ref<VehicleConstraint>)
  • Constructor Details

    • VehicleConstraintRef

      public VehicleConstraintRef()
      Instantiate an empty reference.
  • Method Details

    • overrideGravity

      public void overrideGravity(float ax, float ay, float az)
      Override the vehicle's gravity vector.
      Parameters:
      ax - the X component of the desired acceleration vector
      ay - the Y component of the desired acceleration vector
      az - the Z component of the desired acceleration vector
    • overrideGravity

      public void overrideGravity(Vec3Arg acceleration)
      Override the vehicle's gravity vector.
      Parameters:
      acceleration - the desired acceleration vector (not null, unaffected)
    • resetGravityOverride

      public void resetGravityOverride()
      Remove the gravity override, if any.
    • countAntiRollBars

      public int countAntiRollBars()
      Count how many anti-roll bars the vehicle has. The constraint is unaffected.
      Specified by:
      countAntiRollBars in interface ConstVehicleConstraint
      Returns:
      the count (≥0)
    • countWheels

      public int countWheels()
      Count how many wheels the vehicle has. The constraint is unaffected.
      Specified by:
      countWheels in interface ConstVehicleConstraint
      Returns:
      the count (≥0)
    • getAntiRollBar

      public VehicleAntiRollBar getAntiRollBar(int barIndex)
      Access the specified anti-roll bar.
      Specified by:
      getAntiRollBar in interface ConstVehicleConstraint
      Parameters:
      barIndex - the index of the bar to access (≥0)
      Returns:
      a new JVM object with the pre-existing native object assigned
    • getConstraintPriority

      public int getConstraintPriority()
      Return the constraint's priority when solving. The constraint is unaffected.
      Specified by:
      getConstraintPriority in interface ConstConstraint
      Returns:
      the priority level
    • getConstraintSettings

      public ConstraintSettingsRef getConstraintSettings()
      Generate settings to reconstruct the constraint. The constraint is unaffected.
      Specified by:
      getConstraintSettings in interface ConstConstraint
      Returns:
      a new counted reference to a new settings object
    • getEnabled

      public boolean getEnabled()
      Test whether the constraint is enabled. The constraint is unaffected.
      Specified by:
      getEnabled in interface ConstConstraint
      Returns:
      true if enabled, otherwise false
    • getGravityOverride

      public Vec3 getGravityOverride()
      Copy the gravity override. The constraint is unaffected.
      Specified by:
      getGravityOverride in interface ConstVehicleConstraint
      Returns:
      a new vector
    • getLocalForward

      public Vec3 getLocalForward()
      Copy the local "forward" direction. The constraint is unaffected.
      Specified by:
      getLocalForward in interface ConstVehicleConstraint
      Returns:
      a new direction vector
    • getLocalUp

      public Vec3 getLocalUp()
      Copy the local "up" direction. The constraint is unaffected.
      Specified by:
      getLocalUp in interface ConstVehicleConstraint
      Returns:
      a new direction vector
    • getMaxPitchRollAngle

      public float getMaxPitchRollAngle()
      Return the vehicle's maximum pitch/roll angle. The constraint is unaffected.
      Specified by:
      getMaxPitchRollAngle in interface ConstVehicleConstraint
      Returns:
      the limit angle (in radians)
    • getNumPositionStepsOverride

      public int getNumPositionStepsOverride()
      Return the override for the number of position iterations used in the solver. The constraint is unaffected.
      Specified by:
      getNumPositionStepsOverride in interface ConstConstraint
      Returns:
      the number of iterations, or 0 to use the default in PhysicsSettings
    • getNumStepsBetweenCollisionTestActive

      public int getNumStepsBetweenCollisionTestActive()
      Return the number of simulation steps between wheel-collision tests when the vehicle is active. The constraint is unaffected.
      Specified by:
      getNumStepsBetweenCollisionTestActive in interface ConstVehicleConstraint
      Returns:
      the number of steps
    • getNumStepsBetweenCollisionTestInactive

      public int getNumStepsBetweenCollisionTestInactive()
      Return the number of simulation steps between collision tests when the body is inactive. The constraint is unaffected.
      Specified by:
      getNumStepsBetweenCollisionTestInactive in interface ConstVehicleConstraint
      Returns:
      the number of steps
    • getNumVelocityStepsOverride

      public int getNumVelocityStepsOverride()
      Return the override for the number of velocity iterations used in the solver. The constraint is unaffected.
      Specified by:
      getNumVelocityStepsOverride in interface ConstConstraint
      Returns:
      the number of iterations, or 0 to use the default in PhysicsSettings
    • getSubType

      public EConstraintSubType getSubType()
      Return the constraint's subtype. The constraint is unaffected.
      Specified by:
      getSubType in interface ConstConstraint
      Returns:
      an enum value (not null)
    • getType

      public EConstraintType getType()
      Return the constraint's type. The constraint is unaffected.
      Specified by:
      getType in interface ConstConstraint
      Returns:
      an enum value (not null)
    • getWheelLocalBasis

      public void getWheelLocalBasis(Wheel wheel, Vec3 storeForward, Vec3 storeUp, Vec3 storeRight)
      Copy the basis vectors for the specified wheel.
      Specified by:
      getWheelLocalBasis in interface ConstVehicleConstraint
      Parameters:
      wheel - which wheel to query (not null)
      storeForward - storage for the forward vector (not null, modified)
      storeUp - storage for the up vector (not null, modified)
      storeRight - storage for the right vector (not null, modified)
    • getWheelWorldTransform

      public RMat44 getWheelWorldTransform(int wheelIndex, Vec3Arg right, Vec3Arg up)
      Copy the world transform of the specified wheel. The constraint is unaffected.
      Specified by:
      getWheelWorldTransform in interface ConstVehicleConstraint
      Parameters:
      wheelIndex - the index of the wheel to query (≥0)
      right - the wheel's axis of rotation (a unit vector in the wheel's model space)
      up - the "up" direction (a unit vector in the wheel's model space)
      Returns:
      a new coordinate transform matrix
    • getWorldUp

      public Vec3 getWorldUp()
      Copy the "up" direction based on gravity. The constraint is unaffected.
      Specified by:
      getWorldUp in interface ConstVehicleConstraint
      Returns:
      a new direction vector (in system coordinates)
    • isActive

      public boolean isActive()
      Test whether the constraint is active. The constraint is unaffected.
      Specified by:
      isActive in interface ConstConstraint
      Returns:
      true if active, otherwise false
    • isGravityOverridden

      public boolean isGravityOverridden()
      Test whether gravity is overridden. The constraint is unaffected.
      Specified by:
      isGravityOverridden in interface ConstVehicleConstraint
      Returns:
      true if overridden, otherwise false
    • saveState

      public void saveState(StateRecorder recorder)
      Save the state of the constraint, for possible replay. The constraint is unaffected.
      Specified by:
      saveState in interface ConstConstraint
      Parameters:
      recorder - the recorder to write to (not null)
    • getPtr

      public VehicleConstraint getPtr()
      Temporarily access the referenced VehicleConstraint.
      Specified by:
      getPtr in class Ref
      Returns:
      a new JVM object with the pre-existing native object assigned
    • targetVa

      public long targetVa()
      Return the address of the native VehicleConstraint. No objects are affected.
      Specified by:
      targetVa in interface ConstJoltPhysicsObject
      Overrides:
      targetVa in class JoltPhysicsObject
      Returns:
      a virtual address (not zero)
    • toRef

      public VehicleConstraintRef toRef()
      Create another counted reference to the native VehicleConstraint.
      Specified by:
      toRef in class Ref
      Returns:
      a new JVM object with a new native object assigned