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

Constructor

new Box2dDistanceJoint(objectA, objectB, anchorA, anchorB, collideopt)

Create a distance joint

Parameters:
NameTypeAttributesDefaultDescription
objectABox2dObject
objectBBox2dObject
anchorAVector2
anchorBVector2
collideboolean<optional>
false

Extends

  • Box2dJoint

Methods

getDampingRatio() → {number}

Get the damping ratio

Returns:
Type: 
number

getFrequency() → {number}

Get the frequency in Hertz

Returns:
Type: 
number

getLength() → {number}

Get the length of the joint

Returns:
Type: 
number

getLocalAnchorA() → {Vector2}

Get the local anchor point relative to objectA's origin

Returns:
Type: 
Vector2

getLocalAnchorB() → {Vector2}

Get the local anchor point relative to objectB's origin

Returns:
Type: 
Vector2

setDampingRatio(ratio)

Set the damping ratio

Parameters:
NameTypeDescription
rationumber

setFrequency(hz)

Set the frequency in Hertz

Parameters:
NameTypeDescription
hznumber

setLength(length)

Set the length of the joint

Parameters:
NameTypeDescription
lengthnumber