DistanceJoint

Constraintnape.constraint.DistanceJoint (final class)

DistanceJoint limiting the distance between two local anchor points of Bodies.

The equation for this constraint could be written like:

jointMin <= distance(body2.localPointToWorld(anchor2), body1.localPointToWorld(anchor1)) <= jointMax

This joint is not designed to work when jointMin = jointMax = 0 and constraint is stiff. In this instance you should use a PivotJoint instead.

Instance Members

@private


nape
body1: Null<nape.phys.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.


nape
body2: Null<nape.phys.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.


nape
anchor1: nape.geom.Vec2

Anchor point on first Body.

This anchor point is defined in the local coordinate system of body1.


nape
anchor2: nape.geom.Vec2

Anchor point on second Body.

This anchor point is defined in the local coordinate system of body2.


nape
jointMin: Float

Lower bound for constraint.

This value must be less than or equal to jointMax, and greater equal to 0.


nape
jointMax: Float

Upper bound for constraint.

This value must be greater than or equal to jointMin.


nape
isSlack(): Bool

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.

nape
impulse(): nape.geom.MatMN

@inheritDoc

For this constraint, the MatMN will be 1x1.

Returns
nape.geom.MatMN

nape
bodyImpulse(body: nape.phys.Body): nape.geom.Vec3

@inheritDoc

Name Type
body nape.phys.Body
Returns
nape.geom.Vec3

nape
visitBodies(lambda: Function): Void

@inheritDoc

Name Type
lambda Function

nape
new(body1: Null<nape.phys.Body>, body2: Null<nape.phys.Body>, anchor1: nape.geom.Vec2, anchor2: nape.geom.Vec2, jointMin: Float, jointMax: Float): Void

Construct a new DistanceJoint.

Name Type Description
body1 Null<nape.phys.Body> The first body in DistanceJoint.
body2 Null<nape.phys.Body> The second body in DistanceJoint.
anchor1 nape.geom.Vec2 The first local anchor for joint.
anchor2 nape.geom.Vec2 The second local anchor for joint.
jointMin Float The lower bound for constraint.
jointMax Float The upper bound for constraint.

Private Members

Metadata

Name Parameters
:final -