Class SliderConstraint

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

public class SliderConstraint extends TwoBodyConstraint
A TwoBodyConstraint that allows translation only along one axis and disables rotation, eliminating 5 degrees of freedom.
  • Method Details

    • getCurrentPosition

      public float getCurrentPosition()
      Return the current offset from rest position. The constraint is unaffected.
      Returns:
      the offset (in meters)
    • getLimitsMax

      public float getLimitsMax()
      Return the upper limit of translation. The constraint is unaffected.
      Returns:
      the upper limit (in meters)
    • getLimitsMin

      public float getLimitsMin()
      Return the lower limit of translation. The constraint is unaffected.
      Returns:
      the lower limit (in meters)
    • getLimitsSpringSettings

      public SpringSettings getLimitsSpringSettings()
      Access the spring settings.
      Returns:
      a new JVM object with the pre-existing native object assigned
    • getMaxFrictionForce

      public float getMaxFrictionForce()
      Return the maximum friction force when not driven by a motor. The constraint is unaffected.
      Returns:
      the force (in Newtons)
    • getMotorSettings

      public MotorSettings getMotorSettings()
      Access the motor settings.
      Returns:
      a new JVM object with the pre-existing native object assigned
    • getMotorState

      public EMotorState getMotorState()
      Return the state of the motor. The constraint is unaffected.
      Returns:
      an enum value (not null)
    • getTargetPosition

      public float getTargetPosition()
      Return the target position of the motor. The constraint is unaffected.
      Returns:
      the linear offset (in meters)
    • getTargetVelocity

      public float getTargetVelocity()
      Return the target velocity of the motor. The constraint is unaffected.
      Returns:
      the velocity (in meters per second)
    • hasLimits

      public boolean hasLimits()
      Test whether the constraint has limits. The constraint is unaffected.
      Returns:
      true if limited, otherwise false
    • setLimits

      public void setLimits(float min, float max)
      Alter the limits.
      Parameters:
      min - the desired lower limit (in meters)
      max - the desired upper limit (in meters)
    • setMaxFrictionForce

      public void setMaxFrictionForce(float force)
      Alter the maximum friction force when not driven by a motor.
      Parameters:
      force - the desired force (in Newtons)
    • setMotorState

      public void setMotorState(EMotorState state)
      Alter the state of the motor.
      Parameters:
      state - the desired state (not null)
    • setTargetPosition

      public void setTargetPosition(float offset)
      Alter the target position of the motor.
      Parameters:
      offset - the desired linear offset (in meters)
    • setTargetVelocity

      public void setTargetVelocity(float velocity)
      Alter the target velocity of the motor.
      Parameters:
      velocity - the desired linear velocity (in meters per second)