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

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

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

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

getRatio() → {number}

Get the pulley ratio

Returns:
Type: 
number

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