Interface ConstSpringSettings
- All Superinterfaces:
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.float
Return the spring's damping.float
Return the spring's frequency.getMode()
Return how the spring is specified.float
Return the spring's stiffness.boolean
Test for valid frequency/stiffness.void
saveBinaryState
(StreamOut stream) Save the settings to the specified binary stream.Methods inherited from interface java.lang.Comparable
compareTo
Methods 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
null
if none
-
getConstraintSettings
ConstConstraintSettings getConstraintSettings()Access the underlyingConstraintSettings
, 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 orT = -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 orT = -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), 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)
-