mwg API
    Preparing search index...

    Interface XpbdLinkSpec<T>

    What XpbdWorld.addLink takes. a and b are node indices as returned by addNode.

    interface XpbdLinkSpec<T = undefined> {
        a: number;
        b: number;
        data?: T;
        mass?: number;
        rest?: number;
        stiffness: number;
        strength?: number;
        tensionOnly?: boolean;
        tensionStrength?: number;
    }

    Type Parameters

    • T = undefined
    Index
    a: number
    b: number
    data?: T

    the game's own payload for this link (a material, a source index), kept on XpbdLink.data

    mass?: number

    mass of the link itself, shared evenly between its two nodes

    rest?: number

    rest length; the current distance between the nodes when omitted

    stiffness: number

    spring stiffness: force per unit of stretch ratio. Higher is more rigid

    strength?: number

    the load it carries in compression before breaking; also in tension unless tensionStrength is set. Unbreakable when omitted

    tensionOnly?: boolean

    a cable: pulls when stretched and goes slack, without pushing, when compressed

    tensionStrength?: number

    the load it carries in tension before breaking, when that differs from strength