Class MotorSettings

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

public final class MotorSettings extends JoltPhysicsObject
Settings used to construct a constraint motor.
  • Constructor Details

    • MotorSettings

      public MotorSettings(float frequency, float damping)
      Instantiate settings for the specified spring parameters with no limits.
      Parameters:
      frequency - the desired spring frequency (in Hertz)
      damping - the desired damping
    • MotorSettings

      public MotorSettings(float frequency, float damping, float forceLimit, float torqueLimit)
      Instantiate settings for the specified spring parameters and limits.
      Parameters:
      frequency - the desired spring frequency (in Hertz)
      damping - the desired damping
      forceLimit - the desired force limit
      torqueLimit - the desired torque limit
  • Method Details

    • getConstraint

      public Constraint getConstraint()
      Access the underlying Constraint, if any.
      Returns:
      the pre-existing instance, or null if none
    • getConstraintSettings

      public ConstraintSettings getConstraintSettings()
      Access the underlying ConstraintSettings, if any.
      Returns:
      the pre-existing instance, or null if none
    • getMaxForceLimit

      public float getMaxForceLimit()
      Return the maximum force to apply in a linear constraint. Ignored in an angular motor. The settings are unaffected. (native attribute: mMaxForceLimit)
      Returns:
      the amount of force (in Newtons, typically positive)
    • getMaxTorqueLimit

      public float getMaxTorqueLimit()
      Return the maximum torque to apply in an angular constraint. Ignored in a linear motor. The settings are unaffected. (native attribute: mMaxTorqueLimit)
      Returns:
      the amount of torque (in Newton.meters, typically positive)
    • getMinForceLimit

      public float getMinForceLimit()
      Return the minimum force to apply in a linear constraint. Ignored in an angular motor. The settings are unaffected. (native attribute: mMinForceLimit)
      Returns:
      the amount of force (in Newtons, typically negative)
    • getMinTorqueLimit

      public float getMinTorqueLimit()
      Return the minimum torque to apply in an angular constraint. Ignored in a linear motor. The settings are unaffected. (native attribute: mMinTorqueLimit)
      Returns:
      the amount of torque (in Newton.meters, typically negative)
    • getSpringSettings

      public SpringSettings getSpringSettings()
      Access the settings for the spring used to drive to the position target. Ignored in a velocity motor. The motor settings are unaffected. (native attribute: mSpringSettings)
      Returns:
      a new JVM object with the pre-existing native object assigned
    • isValid

      public boolean isValid()
      Test whether the settings are valid. They are unaffected.
      Returns:
      true if valid, otherwise false
    • setForceLimit

      public void setForceLimit(float limit)
      Alter both force limits of a linear motor to be symmetrical.
      Parameters:
      limit - the desired limit (in Newtons)
    • setForceLimits

      public void setForceLimits(float min, float max)
      Alter both force limits of a linear motor.
      Parameters:
      min - the desired lower limit (in Newtons, default=-MAX_FLOAT)
      max - the desired upper limit (in Newtons, default=MAX_FLOAT)
    • setMaxForceLimit

      public void setMaxForceLimit(float force)
      Alter the maximum force to apply in a linear constraint. Ignored in an angular motor. (native attribute: mMaxForceLimit)
      Parameters:
      force - the desired amount of force (in Newtons, typically positive, default=MAX_VALUE)
    • setMaxTorqueLimit

      public void setMaxTorqueLimit(float torque)
      Alter the maximum torque to apply in an angular constraint. Ignored in a linear motor. (native attribute: mMaxTorqueLimit)
      Parameters:
      torque - the desired amount of torque (in Newton.meters, typically positive, default=MAX_VALUE)
    • setMinForceLimit

      public void setMinForceLimit(float force)
      Alter the minimum force to apply in a linear constraint. Ignored in an angular motor. (native attribute: mMinForceLimit)
      Parameters:
      force - the desired amount of force (in Newtons, typically negative, default=-MAX_VALUE)
    • setMinTorqueLimit

      public void setMinTorqueLimit(float torque)
      Alter the minimum torque to apply in an angular constraint. Ignored in a linear motor. (native attribute: mMinTorqueLimit)
      Parameters:
      torque - the desired amount of torque (in Newton.meters, typically negative, default=-MAX_VALUE)
    • setTorqueLimit

      public void setTorqueLimit(float limit)
      Alter both torque limits of an angular motor to be symmetrical.
      Parameters:
      limit - the desired upper limit (in Newton.meters)
    • setTorqueLimits

      public void setTorqueLimits(float min, float max)
      Alter both torque limits of an angular motor.
      Parameters:
      min - the desired lower limit (in Newton.meters, default=-MAX_FLOAT)
      max - the desired upper limit (in Newton.meters, default=MAX_FLOAT)