PhysicsBoxScope

@Stable
interface PhysicsBoxScope

Receiver scope for PhysicsBox content.

Use physicsBody to register a composable as a physics body. The body is identified by key, measured by Compose, and synchronized with the simulation. The engine then drives the visual transform of the composable based on the current world snapshot.

The extension is intentionally scope-local so you can call it as Modifier.physicsBody(...) inside PhysicsBox { ... }.

Functions

Link copied to clipboard
abstract fun Modifier.physicsBody(key: Any, config: PhysicsBodyConfig = PhysicsBodyConfig(), shape: PhysicsShape = PhysicsShape.Box, filter: CollisionFilter = CollisionFilter.Default, isDraggable: Boolean = true, dragConfig: DragConfig = DragConfig(), onCollision: (CollisionEvent) -> Unit? = null, onSleepChanged: (Boolean) -> Unit? = null, onDragStart: (DragEvent) -> Unit? = null, onDragEnd: (DragEvent) -> Unit? = null): Modifier

Registers the composable as a physics body and enables optional pointer-driven dragging.