Interface ConstSpringSettings
- All Superinterfaces:
AutoCloseable,Comparable<JoltPhysicsObject>,ConstJoltPhysicsObject
- All Known Implementing Classes:
SpringSettings
SpringSettings object. (native type: const
SpringSettings)-
Method Summary
Modifier and TypeMethodDescriptionAccess the underlyingConstraint, if any.Access the underlyingConstraintSettings, if any.floatReturn the spring's damping.floatReturn the spring's frequency.getMode()Return how the spring is specified.floatReturn the spring's stiffness.booleanTest for valid frequency/stiffness.voidsaveBinaryState(StreamOut stream) Save the settings to the specified binary stream.Methods inherited from interface java.lang.Comparable
compareToMethods inherited from interface com.github.stephengold.joltjni.readonly.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, targetVa
-
Method Details
-
getConstraint
ConstConstraint getConstraint()Access the underlyingConstraint, if any. The settings are unaffected.- Returns:
- the pre-existing instance, or
nullif none
-
getConstraintSettings
ConstConstraintSettings getConstraintSettings()Access the underlyingConstraintSettings, if any. The settings are unaffected.- Returns:
- the pre-existing instance, or
nullif 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
cin the spring equation:F = -k * x - c * vfor a linear spring orT = -k * theta - c * wfor 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
kin the spring equation:F = -k * x - c * vfor a linear spring orT = -k * theta - c * wfor 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:
trueif valid (the constraint will have soft limits), otherwisefalse(hard limits)
-
saveBinaryState
Save the settings to the specified binary stream. The settings are unaffected.- Parameters:
stream- the stream to write to (not null)
-