melonJS
    Preparing search index...

    Interface ShapeEntry

    One fixture of a collision shape file, as exported by a physics-shape editor. Geometry is either a polygon outline or a circle, and the material values beside it are custom parameters the exporter template declares rather than guaranteed fields, so the spelling varies between templates. melonJS reads the common ones.

    Reached through BodyDefinitionInit.shapes; never written by hand in the usual case, where shapes names the preloaded file instead.

    interface ShapeEntry {
        bounce?: number;
        center?: { x: number; y: number };
        circle?: { radius: number; x: number; y: number };
        collisionMask?: number;
        collisionType?: number;
        density?: number;
        friction?: number;
        isSensor?: boolean;
        radius?: number;
        restitution?: number;
        shape?: number[];
        vertices?: { x: number; y: number }[] | { x: number; y: number }[][];
    }
    Index
    bounce?: number

    bounciness; restitution is the other spelling

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

    circle centre, paired with a sibling radius

    circle?: { radius: number; x: number; y: number }

    circle geometry, becoming an Ellipse

    collisionMask?: number

    collision filtering, in melonJS's own names. See above.

    collisionType?: number

    Collision filtering, in melonJS's own names, for a file written or adjusted by hand. These are collision.types values.

    The exporting tool's own filter block (categoryBits / maskBits, in any spelling) is deliberately NOT read: those numbers live in that tool's namespace, a template writes its defaults for every fixture whether or not the author set anything, and its default category 1 is melonJS's PLAYER_OBJECT. Importing them would silently tag a shape as something it is not and stop it colliding. Set filtering on the body definition instead.

    density?: number

    mass per unit area

    friction?: number

    surface friction during contact

    isSensor?: boolean

    the fixture reports collisions without a physical response

    radius?: number

    circle radius, when the centre sits beside it rather than inside it

    restitution?: number

    bounciness; bounce is the other spelling

    shape?: number[]

    polygon outline as a flat [x0, y0, x1, y1, …] coordinate list

    vertices?: { x: number; y: number }[] | { x: number; y: number }[][]

    polygon outline as points. A concave outline is exported already decomposed, so this is normally a list of convex pieces, each of which becomes its own Polygon; a single outline is also read.