LittleJS 1.31.0

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:2287

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:2342

Get the current length of the segment attached to objectA

getCurrentLengthB() → numberbox2d.js:2346

Get the current length of the segment attached to objectB

getGroundAnchorA() → Vector2box2d.js:2322

Get the first ground anchor

getGroundAnchorB() → Vector2box2d.js:2326

Get the second ground anchor

getLengthA() → numberbox2d.js:2330

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

getLengthB() → numberbox2d.js:2334

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

getRatio() → numberbox2d.js:2338

Get the pulley ratio