Documentation
    Preparing search index...

    Interface PolygonShape

    A convex polygon in the XY plane, "2d" only (§24).

    Convexity is required and validated. §24 lists polyline and chain separately for open and concave outlines (both staged, see the module header), which leaves polygon as the closed convex primitive that solvers accept directly. Passing a concave outline to a solver that assumes convexity silently substitutes its convex hull — a wrong simulation that looks almost right — so validateCollisionShape rejects it instead (decision, WP-5.1).

    Either winding is accepted. Vertices are in the collider's local frame; the polygon is implicitly closed from the last vertex back to the first.

    interface PolygonShape {
        type: "polygon";
        vertices: readonly Vector2[];
    }
    Index
    type: "polygon"
    vertices: readonly Vector2[]

    At least three vertices, in order around the outline, with no two consecutive vertices equal and no reflex corner.