API Docs for: 0.7.1
Show:

Spring Class

A spring, connecting two bodies. The Spring explicitly adds force and angularForce to the bodies and does therefore not put load on the constraint solver.

Constructor

Spring

(
  • bodyA
  • bodyB
  • [options]
)

Parameters:

  • bodyA Body
  • bodyB Body
  • [options] Object optional
    • [stiffness=100] Number optional

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

    • [damping=1] Number optional

      A number >= 0. Default: 1

    • [localAnchorA] Array optional

      Where to hook the spring to body A, in local body coordinates. Defaults to the body center.

    • [localAnchorB] Array optional
    • [worldAnchorA] Array optional

      Where to hook the spring to body A, in world coordinates. Overrides the option "localAnchorA" if given.

    • [worldAnchorB] Array optional

Item Index

Methods

Methods

applyForce

()

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.

stiffness

Number

Stiffness of the spring.