PhysicsCommand

sealed interface PhysicsCommand

Commands produced by UI/layout code and consumed by the runtime physics backend.

Commands are enqueued via PhysicsBoxState.enqueueCommand (or its convenience helpers) and drained by the runtime integration.

Naming convention:

  • fields with Px / PxPerSec suffix are expressed in container pixel space

  • fields without suffix are interpreted by the runtime (often physics/world units)

Inheritors

Types

Link copied to clipboard
data class BeginDrag(val key: Any, val grabPointPx: PhysicsVector2, val pointerId: Long? = null, val targetPx: PhysicsVector2, val dragConfig: DragConfig) : PhysicsCommand

Begins a drag interaction for a body.

Link copied to clipboard
data class CancelDrag(val key: Any) : PhysicsCommand

Cancels an active drag interaction.

Link copied to clipboard
data class EndDrag(val key: Any, val velocityPxPerSec: PhysicsVector2) : PhysicsCommand

Ends a drag interaction and provides release velocity.

Link copied to clipboard
data class EnqueueImpulse(val key: Any, val impulseX: Float, val impulseY: Float, val wake: Boolean = true) : PhysicsCommand

Applies a linear impulse to a body.

Link copied to clipboard
data class EnqueueVelocity(val key: Any, val velocityX: Float, val velocityY: Float) : PhysicsCommand

Sets/overwrites linear velocity of a body.

Link copied to clipboard

Requests a full runtime world reset.

Link copied to clipboard
data class SetWorldGravity(val gravity: PhysicsVector2) : PhysicsCommand

Updates world gravity vector.

Link copied to clipboard
data class UpdateDrag(val key: Any, val targetPx: PhysicsVector2) : PhysicsCommand

Updates drag target for an active drag interaction.