LittleJS 1.28.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:2147

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

Get the current length of the segment attached to objectA

getCurrentLengthB() → numberbox2d.js:2205

Get the current length of the segment attached to objectB

getGroundAnchorA() → Vector2box2d.js:2181

Get the first ground anchor

getGroundAnchorB() → Vector2box2d.js:2185

Get the second ground anchor

getLengthA() → numberbox2d.js:2189

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

getLengthB() → numberbox2d.js:2193

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

getRatio() → numberbox2d.js:2197

Get the pulley ratio