LittleJS 1.29.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:1535

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

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

getFrequency() → numberbox2d.js:1581

Get the frequency in Hertz

getLength() → numberbox2d.js:1573

Get the length of the joint

getLocalAnchorA() → Vector2box2d.js:1561

Get the local anchor point relative to objectA's origin

getLocalAnchorB() → Vector2box2d.js:1565

Get the local anchor point relative to objectB's origin

setDampingRatio(ratio)box2d.js:1585

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

ratio number
setFrequency(hz)box2d.js:1577

Set the frequency in Hertz

hz number
setLength(length)box2d.js:1569

Set the length of the joint

length number