Skip to content

Class: PulleyJoint

The pulley joint is connected to two bodies and two fixed ground points. The pulley supports a ratio such that: length1 + ratio * length2 <= constant

Yes, the force transmitted is scaled by the ratio.

Warning: the pulley joint can get a bit squirrelly by itself. They often work better when combined with prismatic joints. You should also cover the the anchor points with static shapes to prevent one side from going to zero length.

Extends

Constructors

Constructor

new PulleyJoint(def): PulleyJoint

Parameters

def

PulleyJointDef

Returns

PulleyJoint

Overrides

Joint.constructor

Constructor

new PulleyJoint(def, bodyA, bodyB, groundA?, groundB?, anchorA?, anchorB?, ratio?): PulleyJoint

Parameters

def

PulleyJointOpt

bodyA

Body

bodyB

Body

groundA?

Vec2Value

groundB?

Vec2Value

anchorA?

Vec2Value

anchorB?

Vec2Value

ratio?

number

Returns

PulleyJoint

Overrides

Joint.constructor

Properties

style

style: Style = {}

Styling for dev-tools.

Inherited from

Joint.style


TYPE

static TYPE: "pulley-joint"

Methods

getAnchorA()

getAnchorA(): Vec2

Get the anchor point on bodyA in world coordinates.

Returns

Vec2

Overrides

Joint.getAnchorA


getAnchorB()

getAnchorB(): Vec2

Get the anchor point on bodyB in world coordinates.

Returns

Vec2

Overrides

Joint.getAnchorB


getBodyA()

getBodyA(): Body

Get the first body attached to this joint.

Returns

Body

Inherited from

Joint.getBodyA


getBodyB()

getBodyB(): Body

Get the second body attached to this joint.

Returns

Body

Inherited from

Joint.getBodyB


getCollideConnected()

getCollideConnected(): boolean

Get collide connected. Note: modifying the collide connect flag won't work correctly because the flag is only checked when fixture AABBs begin to overlap.

Returns

boolean

Inherited from

Joint.getCollideConnected


getCurrentLengthA()

getCurrentLengthA(): number

Get the current length of the segment attached to bodyA.

Returns

number


getCurrentLengthB()

getCurrentLengthB(): number

Get the current length of the segment attached to bodyB.

Returns

number


getGroundAnchorA()

getGroundAnchorA(): Vec2

Get the first ground anchor.

Returns

Vec2


getGroundAnchorB()

getGroundAnchorB(): Vec2

Get the second ground anchor.

Returns

Vec2


getLengthA()

getLengthA(): number

Get the current length of the segment attached to bodyA.

Returns

number


getLengthB()

getLengthB(): number

Get the current length of the segment attached to bodyB.

Returns

number


getNext()

getNext(): Joint

Get the next joint the world joint list.

Returns

Joint

Inherited from

Joint.getNext


getRatio()

getRatio(): number

Get the pulley ratio.

Returns

number


getReactionForce()

getReactionForce(inv_dt): Vec2

Get the reaction force on bodyB at the joint anchor in Newtons.

Parameters

inv_dt

number

Returns

Vec2

Overrides

Joint.getReactionForce


getReactionTorque()

getReactionTorque(inv_dt): number

Get the reaction torque on bodyB in N*m.

Parameters

inv_dt

number

Returns

number

Overrides

Joint.getReactionTorque


getType()

getType(): string

Get the type of the concrete joint.

Returns

string

Inherited from

Joint.getType


getUserData()

getUserData(): unknown

Returns

unknown

Inherited from

Joint.getUserData


initVelocityConstraints()

initVelocityConstraints(step): void

Parameters

step

TimeStep

Returns

void

Overrides

Joint.initVelocityConstraints


isActive()

isActive(): boolean

Short-cut function to determine if either body is inactive.

Returns

boolean

Inherited from

Joint.isActive


setUserData()

setUserData(data): void

Parameters

data

unknown

Returns

void

Inherited from

Joint.setUserData


shiftOrigin()

shiftOrigin(newOrigin): void

Shift the origin for any points stored in world coordinates.

Parameters

newOrigin

Vec2Value

Returns

void

Overrides

Joint.shiftOrigin


solvePositionConstraints()

solvePositionConstraints(step): boolean

This returns true if the position errors are within tolerance.

Parameters

step

TimeStep

Returns

boolean

Overrides

Joint.solvePositionConstraints


solveVelocityConstraints()

solveVelocityConstraints(step): void

Parameters

step

TimeStep

Returns

void

Overrides

Joint.solveVelocityConstraints