Package-level declarations

Types

Link copied to clipboard

Physics body type.

Link copied to clipboard
@Immutable
data class CollisionFilter(val categoryBits: Int = 1, val maskBits: Int = 65535, val groupIndex: Int = 0)

Collision filtering parameters used during broad-phase and contact filtering.

Link copied to clipboard
@Immutable
data class PhysicsBodyConfig(val bodyType: BodyType = BodyType.Dynamic, val density: Float = 1.0f, val friction: Float = 0.3f, val restitution: Float = 0.2f, val linearDamping: Float = 0.0f, val angularDamping: Float = 0.0f, val fixedRotation: Boolean = false, val allowSleep: Boolean = true, val isBullet: Boolean = false, val gravityScale: Float = 1.0f, val initialTransform: PhysicsTransform = PhysicsTransform())

Physical parameters for a composable body registered via dev.zinchenko.physicsbox.physicsbody.physicsBody.

Link copied to clipboard
@Immutable
sealed interface PhysicsShape

Shape descriptor used by the body registration API.

Link copied to clipboard
@Immutable
data class PhysicsTransform(val vector2: PhysicsVector2 = PhysicsVector2.Zero, val rotationDegrees: Float = 0.0f)

Initial transform for a body before the simulation starts.

Functions

Link copied to clipboard
fun Modifier.physicsBody(key: Any, config: PhysicsBodyConfig = PhysicsBodyConfig(), shape: PhysicsShape = PhysicsShape.Box, collisionFilter: 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 this composable as a physics body in the nearest dev.zinchenko.physicsbox.layout.PhysicsBox scope.