Moscrif API Docs for: 2012q3
Show:

b2PulleyJoint Class

Library: box2d

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. The pulley also enforces a maximum length limit on both sides. This is useful to prevent one side of the pulley hitting the top. An instance of this class is created by native: B2World/createPulleyJoint or framework createPulleyJoint

Example:

// create the pulley joint
this._pulleyJoint = this.createPulleyJoint(this._rect1, this._rect2, System.width / 4, System.height / 8, 3 * System.width / 4, System.height / 8, System.width / 4, System.height / 2, 3 * System.width / 4, System.height / 2, 1.0 , true)

Methods

getGroundAnchorA

() Multivalue

Get the first ground anchor.

Returns:

Multivalue: Pair of float values: x and y coordinate of anchor point.

getGroundAnchorB

() Multivalue

Get the second ground anchor.

Returns:

Multivalue: Pair of float values: x and y coordinate of anchor point.

getLength1

() Float

Get the current length of the segment attached to bodyA.

Returns:

Float: Length of the segment attached to bodyA.

getLength2

() Float

Get the current length of the segment attached to bodyB.

Returns:

Float: Length of the segment attached to bodyB.

motorSpeed

() Float

Get the pulley ratio.

Returns:

Float: Pulley ratio.