Interface ConstSpringSettings

All Superinterfaces:
Comparable<JoltPhysicsObject>, ConstJoltPhysicsObject
All Known Implementing Classes:
SpringSettings

public interface ConstSpringSettings extends ConstJoltPhysicsObject
Read-only access to a SpringSettings object. (native type: const SpringSettings)
  • Method Details

    • getConstraint

      ConstConstraint getConstraint()
      Access the underlying Constraint, if any. The settings are unaffected.
      Returns:
      the pre-existing instance, or null if none
    • getConstraintSettings

      ConstConstraintSettings getConstraintSettings()
      Access the underlying ConstraintSettings, if any. The settings are unaffected.
      Returns:
      the pre-existing instance, or null if none
    • getDamping

      float getDamping()
      Return the spring's damping. The settings are unaffected.

      When the mode is FrequencyAndDamping, this is the damping ratio (0 = no damping, 1 = critical damping). When the mode is StiffnessAndDamping, this is the damping coefficient c in the spring equation: F = -k * x - c * v for a linear spring or T = -k * theta - c * w for an angular spring.

      Returns:
      the damping value
    • getFrequency

      float getFrequency()
      Return the spring's frequency. The settings are unaffected.

      Effective only when the mode is FrequencyAndDamping. If positive, the constraint will have soft limits, and mFrequency specifies the oscillation frequency in Hz. If negative, the constraint will have hard limits.

      Returns:
      the frequency value
    • getMode

      ESpringMode getMode()
      Return how the spring is specified. The settings are unaffected.
      Returns:
      an enum value (not null)
    • getStiffness

      float getStiffness()
      Return the spring's stiffness. The settings are unaffected.

      Effective only when the mode is StiffnessAndDamping. If positive, the constraint will have soft limits, and mStiffness specifies the stiffness k in the spring equation: F = -k * x - c * v for a linear spring or T = -k * theta - c * w for an angular spring.

      If negative, the constraint will have hard limits.

      Returns:
      the stiffness value
    • hasStiffness

      boolean hasStiffness()
      Test for valid frequency/stiffness. The settings are unaffected.
      Returns:
      true if valid (the constraint will have soft limits), otherwise false (hard limits)
    • saveBinaryState

      void saveBinaryState(StreamOut stream)
      Save the settings to the specified binary stream. The settings are unaffected.
      Parameters:
      stream - the stream to write to (not null)