LittleJS 1.30.1

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

Extends Box2dJoint

Constructor

new Box2dPulleyJoint(objectA, objectB, groundAnchorA, groundAnchorB, anchorA, anchorB, ratio, collide)box2d.js:2203

Create a pulley joint

objectA Box2dObject
objectB Box2dObject
groundAnchorA Vector2
groundAnchorB Vector2
anchorA Vector2 optional

World position, objectA's position if not given

anchorB Vector2 optional

World position, objectB's position if not given

ratio number optional, default 1
collide boolean optional, default false

Methods

Inherited from Box2dJoint

Methods

getCurrentLengthA() → numberbox2d.js:2258

Get the current length of the segment attached to objectA

getCurrentLengthB() → numberbox2d.js:2262

Get the current length of the segment attached to objectB

getGroundAnchorA() → Vector2box2d.js:2238

Get the first ground anchor

getGroundAnchorB() → Vector2box2d.js:2242

Get the second ground anchor

getLengthA() → numberbox2d.js:2246

Get the rest length of the segment attached to objectA, set at creation

getLengthB() → numberbox2d.js:2250

Get the rest length of the segment attached to objectB, set at creation

getRatio() → numberbox2d.js:2254

Get the pulley ratio