-
- All Known Implementing Classes:
DistanceJoint
,PinJoint
,PrismaticJoint
,WheelJoint
public interface LinearSpringJoint
Represents a linear spring joint.- Since:
- 5.0.0
- Version:
- 5.0.0
- Author:
- William Bittle
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description double
getMaximumSpringForce()
Returns the maximum spring force that will be applied.double
getSpringDampingRatio()
Returns the damping ratio for the spring's damper.double
getSpringForce(double invdt)
Returns the force in netwons applied by the spring in the last timestep.double
getSpringFrequency()
Returns the spring frequency.int
getSpringMode()
Returns the current spring mode.double
getSpringStiffness()
Returns the spring stiffness.boolean
isMaximumSpringForceEnabled()
Returns true if the spring force is limited to the maximum.boolean
isSpringDamperEnabled()
Returns true if the damper is enabled for the spring.boolean
isSpringEnabled()
Returns true if the spring is enabled.void
setMaximumSpringForce(double maximum)
Sets the maximum force the spring can apply.void
setMaximumSpringForceEnabled(boolean enabled)
Sets whether the spring force is limited to the maximum.void
setSpringDamperEnabled(boolean enabled)
Sets whether the spring's damper is enabled or not.void
setSpringDampingRatio(double dampingRatio)
Sets the damping ratio.void
setSpringEnabled(boolean enabled)
Sets whether the spring is enabled or not.void
setSpringFrequency(double frequency)
Sets the spring frequency.void
setSpringStiffness(double stiffness)
Sets the spring stiffness.
-
-
-
Method Detail
-
setSpringEnabled
void setSpringEnabled(boolean enabled)
Sets whether the spring is enabled or not.- Parameters:
enabled
- true if the spring should be enabled
-
isSpringEnabled
boolean isSpringEnabled()
Returns true if the spring is enabled.- Returns:
- boolean
-
setSpringDamperEnabled
void setSpringDamperEnabled(boolean enabled)
Sets whether the spring's damper is enabled or not.NOTE: for the damper to have any effect, the spring must be enabled.
- Parameters:
enabled
- true if the damper should be enabled- See Also:
setSpringEnabled(boolean)
-
isSpringDamperEnabled
boolean isSpringDamperEnabled()
Returns true if the damper is enabled for the spring.NOTE: for the damper to have any effect, the spring must be enabled.
- Returns:
- boolean
- Since:
- 4.0.0
- See Also:
isSpringEnabled()
-
getSpringDampingRatio
double getSpringDampingRatio()
Returns the damping ratio for the spring's damper.- Returns:
- double
-
setSpringDampingRatio
void setSpringDampingRatio(double dampingRatio)
Sets the damping ratio.Larger values reduce the oscillation of the spring.
- Parameters:
dampingRatio
- the damping ratio; in the range (0, 1]- Throws:
IllegalArgumentException
- if damping ratio is less than or equal to zero or greater than 1
-
getSpringFrequency
double getSpringFrequency()
Returns the spring frequency.- Returns:
- double
-
setSpringFrequency
void setSpringFrequency(double frequency)
Sets the spring frequency.Larger values increase the stiffness of the spring.
Calling this method puts the spring into fixed frequency mode. In this mode, the spring stiffness is computed based on the frequency.
- Parameters:
frequency
- the spring frequency in hz; must be greater than zero- Throws:
IllegalArgumentException
- if frequency is less than or equal to zero
-
getSpringStiffness
double getSpringStiffness()
Returns the spring stiffness.- Returns:
- double
-
setSpringStiffness
void setSpringStiffness(double stiffness)
Sets the spring stiffness.Larger values increase the stiffness of the spring.
Calling this method puts the spring into fixed stiffness mode. In this mode, the spring frequency is computed based on the stiffness.
- Parameters:
stiffness
- the spring stiffness (k); must be greater than zero- Throws:
IllegalArgumentException
- if stiffness is less than or equal to zero
-
isMaximumSpringForceEnabled
boolean isMaximumSpringForceEnabled()
Returns true if the spring force is limited to the maximum.- Returns:
- boolean
-
setMaximumSpringForceEnabled
void setMaximumSpringForceEnabled(boolean enabled)
Sets whether the spring force is limited to the maximum.- Parameters:
enabled
- true if the spring force should be limited
-
getMaximumSpringForce
double getMaximumSpringForce()
Returns the maximum spring force that will be applied.- Returns:
- double
-
setMaximumSpringForce
void setMaximumSpringForce(double maximum)
Sets the maximum force the spring can apply.- Parameters:
maximum
- the maximum force- Throws:
IllegalArgumentException
- if maximum is less than or equal to zero
-
getSpringForce
double getSpringForce(double invdt)
Returns the force in netwons applied by the spring in the last timestep.- Parameters:
invdt
- the inverse delta time- Returns:
- double
-
getSpringMode
int getSpringMode()
Returns the current spring mode.NOTE: The spring mode is set automatically when you call either
setSpringFrequency(double)
orsetSpringStiffness(double)
. Use this method to store the spring mode when saving the simulation state and use the value to call eithersetSpringFrequency(double)
orsetSpringStiffness(double)
.- Returns:
- int
- See Also:
Joint.SPRING_MODE_FREQUENCY
,Joint.SPRING_MODE_STIFFNESS
-
-