LittleJS 1.30.1

Box2D

Box2dDistanceJoint

Box2D Distance Joint

  • Constrains two points on two objects to remain at a fixed distance
  • You can view this as a massless, rigid rod

Extends Box2dJoint

Constructor

new Box2dDistanceJoint(objectA, objectB, anchorA, anchorB, collide)box2d.js:1545

Create a distance joint

objectA Box2dObject
objectB Box2dObject
anchorA Vector2 optional

World position, objectA's position if not given

anchorB Vector2 optional

World position, objectB's position if not given

collide boolean optional, default false

Methods

Inherited from Box2dJoint

Methods

getDampingRatio() → numberbox2d.js:1600

Get how much the spring is damped, 0 for none and 1 to stop it bouncing

getFrequency() → numberbox2d.js:1592

Get the frequency in Hertz

getLength() → numberbox2d.js:1584

Get the length of the joint

getLocalAnchorA() → Vector2box2d.js:1572

Get the local anchor point relative to objectA's origin

getLocalAnchorB() → Vector2box2d.js:1576

Get the local anchor point relative to objectB's origin

setDampingRatio(ratio)box2d.js:1596

Set how much the spring is damped, 0 for none and 1 to stop it bouncing

ratio number
setFrequency(hz)box2d.js:1588

Set the frequency in Hertz

hz number
setLength(length)box2d.js:1580

Set the length of the joint

length number