DampedSpringJoint2D¶

Inherits: Joint2D < Node2D < CanvasItem < Node < Object

Category: Core

Brief Description¶

Damped spring constraint for 2D physics.

Member Functions¶

 float get_damping ( ) const float get_length ( ) const float get_rest_length ( ) const float get_stiffness ( ) const void set_damping ( float damping ) void set_length ( float length ) void set_rest_length ( float rest_length ) void set_stiffness ( float stiffness )

Description¶

Damped spring constraint for 2D physics. This resembles a spring joint that always wants to go back to a given length.

Member Function Description¶

• float get_damping ( ) const

Return the damping ratio of the spring joint. A value of 0 indicates an undamped spring, while 1 causes the system to reach equilibrium as fast as possible (critical damping).

• float get_length ( ) const

Return the maximum length of the spring joint.

• float get_rest_length ( ) const

Return the resting length of the spring joint. The joint will always try to go to back this length when pulled apart.

• float get_stiffness ( ) const

Return the stiffness of the spring joint. The joint applies a force equal to the stiffness times the distance from its resting length.

• void set_damping ( float damping )

Set the damping ratio of the spring joint. A value of 0 indicates an undamped spring, while 1 causes the system to reach equilibrium as fast as possible (critical damping).

• void set_length ( float length )

Set the maximum length of the spring joint.

• void set_rest_length ( float rest_length )

Set the resting length of the spring joint. The joint will always try to go to back this length when pulled apart.

• void set_stiffness ( float stiffness )

Set the stiffness of the spring joint. The joint applies a force equal to the stiffness times the distance from its resting length.