Create a Polygon from a list of Vec2 vertices. Vertices must form a convex polygon in counter-clockwise order.
OptionallocalVerts: anyVertices as Array<Vec2>, Vec2List, or GeomPoly.
Optionalmaterial: MaterialMaterial to assign (uses default if omitted).
Optionalfilter: InteractionFilterInteractionFilter to assign (uses default if omitted).
Angular drag coefficient for this shape.
Cross-sectional area of this shape.
World-space AABB of this shape (updated each step).
Cast to Body — returns the Body wrapper if this is a Body, else null.
Cast to Capsule, or null if this is not a capsule.
Cast to Circle, or null if this is not a circle.
Cast to Compound — returns the Compound wrapper if this is a Compound, else null.
Cast to Polygon, or null if this is not a polygon.
Cast to Shape — returns the Shape wrapper if this is a Shape, else null.
Set of callback types registered on this shape for event dispatch.
The list of edges derived from this polygon's vertices.
The InteractionFilter controlling which shapes interact with this one.
If true, this shape participates in fluid interaction.
Fluid simulation properties for this shape. Auto-created on first access.
The interaction group this interactor belongs to.
Unique numeric identifier for this interactor.
Contribution to moment of inertia (about local centroid, unit density).
The list of local-space vertices defining this polygon's shape.
If true, this shape acts as a sensor (no physical response, only callbacks).
The shape type: CIRCLE or POLYGON.
User-defined data storage object.
World-space centre of mass of this shape (read-only, lazy-computed).
World-space vertices of this polygon, updated each simulation step.
Return true if the given world-space point lies inside this shape. Requires the shape to be attached to a Body.
The world-space point to test.
True if the point is inside this shape.
Create a deep copy of this shape with the same type, geometry, material, and filter.
A new Shape instance independent of this one.
Returns true if this interactor is a Body.
Returns true if this is a Capsule shape.
Returns true if this is a Circle shape.
Returns true if this interactor is a Compound.
Returns true if this is a Polygon shape.
Returns true if this interactor is a Shape.
Rotate the shape's local vertices by angle radians.
Rotation in radians.
this for chaining.
Scale the shape's local geometry. Circles require uniform scaling.
Horizontal scale factor (must be non-zero).
Vertical scale factor (must be non-zero).
this for chaining.
Apply a Mat23 affine transform to the shape's local geometry.
The transformation matrix (must be non-singular; Circles require equiorthogonal).
this for chaining.
Validate the polygon geometry and return a string describing any issues, or
"valid" if the polygon is well-formed.
A validation result string from the underlying ZPP_Polygon.
StaticboxCreate an axis-aligned rectangular polygon centred at the origin.
Rectangle width.
Rectangle height (defaults to width for a square).
If true, returned Vec2s are marked weak and will be auto-disposed.
Array of four Vec2 corner vertices.
StaticrectCreate an axis-aligned rectangle at the given position.
Left edge x coordinate.
Top edge y coordinate.
Rectangle width.
Rectangle height.
If true, returned Vec2s are marked weak and will be auto-disposed.
Array of four Vec2 corner vertices.
StaticregularCreate a regular polygon (or ellipse approximation) centred at the origin.
Horizontal radius of the circumscribed ellipse.
Vertical radius of the circumscribed ellipse.
Number of sides (must be >= 3).
Rotation offset in radians applied to all vertices (default 0).
If true, returned Vec2s are marked weak and will be auto-disposed.
Array of edgeCount Vec2 vertices.
A convex polygon physics shape.