Class HingeConstraint

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

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

    • getCurrentAngle

      public float getCurrentAngle()
      Return the current angle from rest orientation. The constraint is unaffected.
      Returns:
      the angle (in radians)
    • getLimitsMax

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

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

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

      public float getMaxFrictionTorque()
      Return the maximum friction torque when not driven by a motor. The constraint is unaffected.
      Returns:
      the torque (in Newton.meters)
    • 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)
    • getTargetAngle

      public float getTargetAngle()
      Return the target angle of the motor. The constraint is unaffected.
      Returns:
      the angle (in radians)
    • getTargetAngularVelocity

      public float getTargetAngularVelocity()
      Return the target angular velocity of the motor. The constraint is unaffected.
      Returns:
      the angular velocity (in radians 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 radians)
      max - the desired upper limit (in radians)
    • setMaxFrictionTorque

      public void setMaxFrictionTorque(float torque)
      Alter the maximum friction torque when not driven by a motor.
      Parameters:
      torque - the desired torque (in Newton.meters)
    • setMotorState

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

      public void setTargetAngle(float angle)
      Alter the target angle of the motor.
      Parameters:
      angle - the desired angle (in radians)
    • setTargetAngularVelocity

      public void setTargetAngularVelocity(float omega)
      Alter the target angular velocity of the motor.
      Parameters:
      omega - the desired angular velocity (in radians per second)