Box2dPinJoint

Box2D Pin Joint

  • Pins two objects together at a point

Constructor

new Box2dPinJoint(objectA, objectB, posopt, collideopt)

Create a pin joint

Parameters:
NameTypeAttributesDefaultDescription
objectABox2dObject
objectBBox2dObject
posVector2<optional>
collideboolean<optional>
false

Extends

Methods

destroy()

Destroy this joint

getAnchorA() → {Vector2}

Get the first anchor for this joint in world coordinates

Returns:
Type: 
Vector2

getAnchorB() → {Vector2}

Get the second anchor for this joint in world coordinates

Returns:
Type: 
Vector2

getCollideConnected() → {boolean}

Check if the connected bodies should collide

Returns:
Type: 
boolean

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

getObjectA() → {Box2dObject}

Get the first object attached to this joint

Returns:
Type: 
Box2dObject

getObjectB() → {Box2dObject}

Get the second object attached to this joint

Returns:
Type: 
Box2dObject

getReactionForce(time) → {Vector2}

Get the reaction force on bodyB at the joint anchor given a time step

Parameters:
NameTypeDescription
timenumber
Returns:
Type: 
Vector2

getReactionTorque(time) → {number}

Get the reaction torque on bodyB in N*m given a time step

Parameters:
NameTypeDescription
timenumber
Returns:
Type: 
number

isActive() → {boolean}

Check if either connected body is active

Returns:
Type: 
boolean

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