PulleyJoint limiting the weighted sum of distances between 2 pairs of 4 local anchor points of Bodies.
The equation for this constraint could be written like:
jointMin <= distance(body2.localPointToWorld(anchor2), body1.localPointToWorld(anchor1)) + ratio * distance(body4.localPointToWorld(anchor4), body3.localPointToWorld(anchor3)) <= jointMaxThis joint is not designed to work when either of these pairs achieves a distance of 0, it will still work but may not be entirely ideal. !1*
* This constraint can be used in a full 4-body set up, or a 3-body set up or a 2-body set up permitting any arrangement as long as body1 != body2 and body3 != body4
Constructor
new(body1:Null<Body>, body2:Null<Body>, body3:Null<Body>, body4:Null<Body>, anchor1:Vec2, anchor2:Vec2, anchor3:Vec2, anchor4:Vec2, jointMin:Float, jointMax:Float, ratio:Float = 1.0)
Construct a new PulleyJoint.
Parameters:
body1 | The first body in PulleyJoint. |
---|---|
body2 | The second body in PulleyJoint. |
body3 | The third body in PulleyJoint. |
body4 | The fourth body in PulleyJoint. |
anchor1 | The first local anchor for joint. |
anchor2 | The second local anchor for joint. |
anchor3 | The third local anchor for joint. |
anchor4 | The fourth local anchor for joint. |
jointMin | The lower bound for constraint. |
jointMax | The upper bound for constraint. |
ratio | The ratio for constraint. |
Returns:
The constructed PulleyJoint.
Variables
body1:Null<Body>
First Body in constraint.
This value may be null, but trying to simulate the constraint whilst
this body is null will result in an error.
body2:Null<Body>
Second Body in constraint.
This value may be null, but trying to simulate the constraint whilst
this body is null will result in an error.
body3:Null<Body>
Third Body in constraint.
This value may be null, but trying to simulate the constraint whilst
this body is null will result in an error.
body4:Null<Body>
Fourth Body in constraint.
This value may be null, but trying to simulate the constraint whilst
this body is null will result in an error.
anchor1:Vec2
Anchor point on first Body.
This anchor point is defined in the local coordinate system of body1.
anchor2:Vec2
Anchor point on second Body.
This anchor point is defined in the local coordinate system of body2.
anchor3:Vec2
Anchor point on third Body.
This anchor point is defined in the local coordinate system of body3.
anchor4:Vec2
Anchor point on fourth Body.
This anchor point is defined in the local coordinate system of body4.
Methods
inlineisSlack():Bool
Determine if constraint is slack.
This constraint is slack if the positional error is within
the bounds of (jointMin, jointMax).
Returns:
True if positional error of constraint is between the limits indicating that the constraint is not doing any work.
Throws:
# | If any of the bodies is null. |
---|