PhysicsShape

@Immutable
sealed interface PhysicsShape

Shape descriptor used by the body registration API.

The shape describes the collision geometry that will be created for the body. The actual dimensions are derived from the composable's measured size unless explicitly provided by the shape implementation.

The public API exposes Box, Circle, and Polygon. Additional shapes can be added later without breaking source compatibility.

Inheritors

Types

Link copied to clipboard
data object Box : PhysicsShape

Rectangle shape based on the composable bounds.

Link copied to clipboard
data class Circle(val radiusPx: Float? = null) : PhysicsShape

Circle shape.

Link copied to clipboard
data class Polygon(val vertices: List<PhysicsVector2>, val space: PhysicsShape.Polygon.VertexSpace = VertexSpace.Normalized) : PhysicsShape

Convex polygon shape (Box2D/jbox2d-style).