package nape.constraint
AngleJoint | AngleJoint constraining the relative angles of two Bodies.
* * jointMin <= ratio * body2.rotation - body1.rotation <= jointMax * |
Constraint | Base type for all Nape joints and constraints |
ConstraintIterator | Haxe Iterator |
ConstraintList | Nape list of Constraint type objects
* * list.foreach(function (obj) { * }); ** This method is inlined so that in haxe no closure will need to be created. * * In AS3, a closure would need to be created in general, so for performance * reasons you 'may' choose to use iteration as follows: * * for (var i:int = 0; i < list.length; i++) { * var obj:Constraint = list.at(i); * } ** * NOTE: It is 'not' safe to modify a list whilst iterating over it. * If you wish to remove elements during an iteration you should use the * filter method, for example: * * list.filter(function (obj) { * // operate on object. * // ... * return (false if you want object to be removed); * }); ** * In AS3, if you wish to avoid a closure generation, you can perform such * an iteration in a safe manner as follows: * * var i:int = 0; * while (i < list.length) { * var obj:Constraint = list.at(i); * // operate on object. * // ... * if (should remove obj) { * list.remove(obj); * continue; * } * else i++; * } ** Or if you are always clearing the list entirely you could write: * * while (!list.empty()) { * var obj:Constraint = list.pop(); * // operate on object. * // ... * } * |
DistanceJoint | DistanceJoint limiting the distance between two local anchor points of Bodies.
* * 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. |
LineJoint | LineJoint constraining anchor of one body, to a line segment of the other.
* * 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. |
MotorJoint | MotorJoint constraining the angular velocities of two bodies
* * (ratio * body2.angularVel) - body1.angularVel = rate ** This constraint operates only on the velocities of objects. |
PivotJoint | PivotJoint constraining two anchors points of bodies to be equal.
* * body2.localPointToWorld(anchor2) = body1.localPointToWorld(anchor1) ** You may view this constraint as being equal to the DistanceJoint constraint * when both its jointMin and jointMax are exactly 0 (In such a case a * DistanceJoint becomes degenerate). Compared to the DistanceJoint this is * a 2 dimensional constraint. |
PulleyJoint | PulleyJoint limiting the weighted sum of distances between 2 pairs of 4 local anchor points of Bodies.
* * 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 |
UserConstraint | UserConstraint providing a low-level API for user-defined Constraints.
* |
WeldJoint | WeldJoint constraining two bodies to be exactly locked together.
* * [ body2.localPointToWorld(anchor2) ] = [ body1.localPointToWorld(anchor1) ] * [ body2.rotation ] [ body1.rotation + phase ] ** This constraint is equivalent to using a PivotJoint and AngleJoint * together except that it is solved as a single constraint and thus * will be more stable. * * This constraint is 3 dimensional. * * Although this constraint is very stable, if you chain bodies together * using this constraint, you should except to see a small amount of rotation * about the anchor points so you should chose them accordingly. |