mwg API
    Preparing search index...

    Interface ConstraintOptions

    Joint options for PhysicsWorld.addConstraint. Lengths and points are in world units.

    interface ConstraintOptions {
        damping?: number;
        length?: number;
        maxStretch?: number;
        pointA?: { x: number; y: number };
        pointB?: { x: number; y: number };
        stiffness?: number;
    }
    Index
    damping?: number

    0 to 1, the share of radial oscillation removed per step; 0 when omitted

    length?: number

    rest length; the distance between the attachment points when omitted

    maxStretch?: number

    Makes the joint breakable: once its two ends are further apart than the rest length times 1 + maxStretch, the constraint is removed and onBreak fires. 0.2 lets a beam stretch 20% before it snaps. For a zero-length joint (a pin) it is the absolute distance instead. The strain is read after each step's solve, so a fully rigid joint (stiffness 1) is pulled back before it is measured under a light load: use a stiffness below 1, as a real beam has. Unbreakable when omitted.

    pointA?: { x: number; y: number }

    attachment points in each body's local space; the body centre when omitted

    pointB?: { x: number; y: number }
    stiffness?: number

    0 to 1, how rigidly the ends are held: 1 is a rod, a small value a spring; 1 when omitted