regularPolygonNormalized

fun regularPolygonNormalized(sides: Int, radius: Float = 0.48f, rotationDegrees: Float = -90f): PhysicsShape.Polygon

Creates a regular convex PhysicsShape.Polygon in normalized local space.

The returned polygon is centered at the body's origin and uses PhysicsShape.Polygon.VertexSpace.Normalized, where x = -0.5..0.5 maps to the composable's width and y = -0.5..0.5 maps to its height. When applied to a non-square composable, the result is stretched to match the measured bounds in the same way as the physics fixture.

Vertices are generated in screen-oriented coordinates (PhysicsVector2 uses y > 0 downward). The default rotationDegrees of -90f places the first vertex at the top.

Parameters

sides

Number of polygon sides. Must stay within the physics backend vertex limit.

radius

Distance from the center to each vertex in normalized local space. Must be finite and > 0. Values above 0.5f are allowed, but they make the shape extend beyond the composable bounds.

rotationDegrees

Clockwise rotation in degrees in the screen-oriented coordinate space. Must be finite.