Physics Box State
Mutable controller for a physics world hosted by dev.zinchenko.physicsbox.layout.PhysicsBox.
This state is intended to be the primary API surface for:
updating world gravity (setWorldGravity, gravity)
configuring stepping/solver parameters (stepConfig, solverIterations)
queuing one-off actions for the runtime (enqueueCommand and helpers)
The state keeps a queue of PhysicsCommand objects. The runtime drains it and applies changes to the underlying physics engine. UI code should treat command helpers as fire-and-forget.
Notes:
This class is Stable to avoid unnecessary recompositions when only internal bookkeeping changes.
Values such as gravity and stepConfig are exposed as Compose state (mutable) and will trigger recomposition when changed. Per-body transforms are intentionally not mirrored here.
Properties
Current world gravity vector.
Monotonic marker that changes when the command queue receives new commands.
Convenience view over solver iteration counts derived from stepConfig.
Current step configuration (timestep/iterations/etc.).
Functions
Generic command extension point for advanced integrations.
Queues a linear velocity update for the body associated with key.
Registers a world step callback.
Convenience helper for updating solver iteration counts.
Sets world gravity and enqueues PhysicsCommand.SetWorldGravity.
Creates an immutable snapshot of the current world-level configuration.
Updates gravity and enqueues the change for the runtime.
Replaces current stepConfig.