class nape.constraint.DistanceJoint extends Constraint

Available on all platforms

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 Fields

var anchor1:Vec2

Anchor point on first Body. *

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

var anchor2:Vec2

Anchor point on second Body. *

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

var 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.

var 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.

var jointMax:Float

Upper bound for constraint. *

* This value must be greater than or equal to jointMin.

var jointMin:Float

Lower bound for constraint. *

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

function new(body1:Null<Body>, body2:Null<Body>, anchor1:Vec2, anchor2:Vec2, jointMin:Float, jointMax:Float):Void

Construct a new DistanceJoint. * *

body1

The first body in DistanceJoint. *

body2

The second body in DistanceJoint. *

anchor1

The first local anchor for joint. *

anchor2

The second local anchor for joint. *

jointMin

The lower bound for constraint. *

jointMax

The upper bound for constraint. *

returns

The constructed DistanceJoint.

function bodyImpulse(body:Body):Vec3

@inheritDoc

function impulse():MatMN

@inheritDoc *

* For this constraint, the MatMN will be 1x1.

function isSlack():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.

function visitBodies(lambda:Body ->Void):Void

@inheritDoc