Box2D. Box2dPulleyJoint

Box2D Pulley Joint

  • Connects to two objects and two fixed ground points
  • The pulley supports a ratio such that: length1 + ratio * length2 <= constant
  • The force transmitted is scaled by the ratio

Constructor

new Box2dPulleyJoint(objectA, objectB, groundAnchorA, groundAnchorB, anchorA, anchorB, ratioopt, collideopt)

Create a pulley joint

Parameters:
NameTypeAttributesDefaultDescription
objectABox2dObject
objectBBox2dObject
groundAnchorAVector2
groundAnchorBVector2
anchorAVector2
anchorBVector2
rationumber<optional>
1
collideboolean<optional>
false

Extends

  • Box2dJoint

Methods

getCurrentLengthA() → {number}

Get the current length of the segment attached to objectA

Returns:
Type: 
number

getCurrentLengthB() → {number}

Get the current length of the segment attached to objectB

Returns:
Type: 
number

getGroundAnchorA() → {Vector2}

Get the first ground anchor

Returns:
Type: 
Vector2

getGroundAnchorB() → {Vector2}

Get the second ground anchor

Returns:
Type: 
Vector2

getLengthA() → {number}

Get the current length of the segment attached to objectA

Returns:
Type: 
number

getLengthB() → {number}

Get the current length of the segment attached to objectB

Returns:
Type: 
number

getRatio() → {number}

Get the pulley ratio

Returns:
Type: 
number