class

CP::Constraint::DampedSpring

Inherits CP::Constraint / Reference / Object

Constructors

new(a : Body, b : Body, anchor_a : Vect, anchor_b : Vect, rest_length : Number, stiffness : Number, damping : Number)

Defined much like a slide joint.

  • anchor_a: Anchor point a, relative to body a
  • anchor_b: Anchor point b, relative to body b
  • rest_length: The distance the spring wants to be at
  • stiffness: The spring constant (Young's modulus)
  • damping: How soft to make the damping of the spring
Source

Instance methods

anchor_a

The location of the first anchor relative to the first body.

Source
anchor_a=(anchor_a : Vect)
Source
anchor_b

The location of the second anchor relative to the second body.

Source
anchor_b=(anchor_b : Vect)
Source
damping

How soft to make the damping of the spring.

Source
damping=(damping : Number)
Source
rest_length

The distance the spring wants to be at.

Source
rest_length=(rest_length : Number)
Source
spring_force(dist : Float64) : Number

(can be overridden in a subclass)

Source
stiffness

The stiffness of the spring in force/distance.

Source
stiffness=(stiffness : Number)
Source