API Docs for: 0.7.1
Show:

RotationalSpring Class

A rotational spring, connecting two bodies rotation. This spring explicitly adds angularForce (torque) to the bodies.

The spring can be combined with a RevoluteConstraint to make, for example, a mouse trap.

Constructor

RotationalSpring

(
  • bodyA
  • bodyB
  • [options]
)

Parameters:

  • bodyA Body
  • bodyB Body
  • [options] Object optional
    • [restAngle] Number optional

      The relative angle of bodies at which the spring is at rest. If not given, it's set to the current relative angle between the bodies.

    • [stiffness=100] Number optional

      Spring constant (see Hookes Law). A number >= 0.

    • [damping=1] Number optional

      A number >= 0.

Item Index

Methods

Methods

applyForce

()

Inherited from Spring but overwritten in src/objects/RotationalSpring.js:36

Apply the spring force to the connected bodies.

Properties

bodyA

Body

First connected body.

bodyB

Body

Second connected body.

damping

Number

Damping of the spring.

restAngle

Number

Rest angle of the spring.

stiffness

Number

Stiffness of the spring.