Function contourToPolygon

  • Attempts to attach a convex b2PolygonShape to bodyId.

    Returns the new shape id on success, or null if the contour is not eligible. Eligibility:

    • At least 3 vertices.
    • At most 8 vertices (Box2D's b2PolygonShape cap).
    • Convex (all consecutive cross products have the same sign).

    Callers (typically the debris path of Box2DAdapter) should fall back to contourToChain when this returns null.

    Parameters

    Returns unknown | null