class nape.constraint.LineJoint extends Constraint

Available on all platforms

LineJoint constraining anchor of one body, to a line segment of the other. *

* The equation for this constraint could be written like: *

 *        0  = [dir.cross(delta)]  = 0
 * jointMin <= [dor.dot  (delta)] <= jointMax
 * 
* where: *
 * dir   = body1.localVectorToWorld(direction).unit();
 * delta = body2.localPointToWorld(anchor2).sub(body1.localPointToWorld(anchor1));
 * 
* This is a 2 dimensional constraint, and is (when at the limits) solved as a * block constraint for better stability. This is however not the most stable * of joint when chained and put under stress and is a rather rare case where * using a non-stiff joint can actually be more stable than * using a stiff one. *

* When jointMin = jointMax , it would be better to use a PivotJoint *instead with suitable * placed anchors. *

* The line segment is defined implicitly via the * anchor1, direction, jointMin and jointMax properties with end * points defined in local coordinate system of body1 like: *
 * start = anchor1.add(direction.unit().mul(jointMin))
 * end   = anchor1.add(direction.unit().mul(jointMax))
 * 
* The reason for this more general description of a line segment is that one or * both of jointMin, jointMax are permitted to be infinite and a line segment * defined with a start and end point is not sufficient to describe such lines.

Instance Fields

var anchor1:Vec2

Anchor point on first Body, defining position on line. *

* 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, defining the line segment. *

* 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 direction:Vec2

Direction of line on first Body. *

* This direction is defined in the local coordinate system of body1 and * need not be normalised.

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.

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

Construct a new LineJoint. * *

body1

The first body in LineJoint. *

body2

The second body in LineJoint. *

anchor1

The first local anchor for joint. *

anchor2

The second local anchor for joint. *

direction

The direction of local line for joint. *

jointMin

The lower bound for constraint. *

jointMax

The upper bound for constraint. *

returns

The constructed LineJoint.

function bodyImpulse(body:Body):Vec3

@inheritDoc

function impulse():MatMN

@inheritDoc *

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

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

@inheritDoc