LittleJS 1.28.0

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:1500

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:1554

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

getFrequency() → numberbox2d.js:1546

Get the frequency in Hertz

getLength() → numberbox2d.js:1538

Get the length of the joint

getLocalAnchorA() → Vector2box2d.js:1526

Get the local anchor point relative to objectA's origin

getLocalAnchorB() → Vector2box2d.js:1530

Get the local anchor point relative to objectB's origin

setDampingRatio(ratio)box2d.js:1550

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

ratio number
setFrequency(hz)box2d.js:1542

Set the frequency in Hertz

hz number
setLength(length)box2d.js:1534

Set the length of the joint

length number