PulleyJoint
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)) <= jointMax
This 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
Instance Members
@private
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.
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.
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.
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.
Anchor point on first Body.
This anchor point is defined in the local coordinate system of body1.
Anchor point on second Body.
This anchor point is defined in the local coordinate system of body2.
Anchor point on third Body.
This anchor point is defined in the local coordinate system of body3.
Anchor point on fourth Body.
This anchor point is defined in the local coordinate system of body4.
Lower bound for constraint.
This value must be less than or equal to jointMax, and greater equal to 0.
Upper bound for constraint.
This value must be greater than or equal to jointMin.
Ratio property of constraint.
@default 1
Determine if constraint is slack.
This constraint is slack if the positional error is within
the bounds of (jointMin, jointMax).
Returns | Description |
---|---|
Bool | True if positional error of constraint is between the limits indicating that the constraint is not doing any work. |
@inheritDoc
For this constraint, the MatMN will be 1x1.
Returns |
---|
nape.geom.MatMN |
@inheritDoc
Name | Type |
---|---|
body |
nape.phys.Body |
Returns |
---|
nape.geom.Vec3 |
@inheritDoc
Name | Type |
---|---|
lambda |
Function |
new(body1: Null<nape.phys.Body>, body2: Null<nape.phys.Body>, body3: Null<nape.phys.Body>, body4: Null<nape.phys.Body>, anchor1: nape.geom.Vec2, anchor2: nape.geom.Vec2, anchor3: nape.geom.Vec2, anchor4: nape.geom.Vec2, jointMin: Float, jointMax: Float, ?ratio: Float = 1.0): Void
Construct a new PulleyJoint.
Name | Type | Default | Description |
---|---|---|---|
body1 |
Null<nape.phys.Body> | The first body in PulleyJoint. | |
body2 |
Null<nape.phys.Body> | The second body in PulleyJoint. | |
body3 |
Null<nape.phys.Body> | The third body in PulleyJoint. | |
body4 |
Null<nape.phys.Body> | The fourth body in PulleyJoint. | |
anchor1 |
nape.geom.Vec2 | The first local anchor for joint. | |
anchor2 |
nape.geom.Vec2 | The second local anchor for joint. | |
anchor3 |
nape.geom.Vec2 | The third local anchor for joint. | |
anchor4 |
nape.geom.Vec2 | The fourth local anchor for joint. | |
jointMin |
Float | The lower bound for constraint. | |
jointMax |
Float | The upper bound for constraint. | |
ratio |
Float | 1.0 |
The ratio for constraint. |
Private Members
Metadata
Name | Parameters |
---|---|
:final |
- |