PhysicsWorldSnapshot

@Immutable
data class PhysicsWorldSnapshot(val isPaused: Boolean, val gravity: PhysicsVector2, val stepConfig: StepConfig, val solverIterations: SolverIterations, val bodies: List<PhysicsBodySnapshot> = emptyList(), val bodiesByKey: Map<Any, PhysicsBodySnapshot> = bodies.associateBy { it.key }, val stepIndex: Long = 0)

Immutable world snapshot used for UI/runtime synchronization.

A snapshot is typically produced by the runtime after stepping the simulation and then consumed by Compose layout/placement code to render the latest transforms.

Conventions:

  • World-level values (gravity, stepConfig, solverIterations) are expressed in runtime/world units.

  • Exported body transforms and velocities are expressed in pixel space (see PhysicsBodySnapshot).

Constructors

Link copied to clipboard
constructor(isPaused: Boolean, gravity: PhysicsVector2, stepConfig: StepConfig, solverIterations: SolverIterations, bodies: List<PhysicsBodySnapshot> = emptyList(), bodiesByKey: Map<Any, PhysicsBodySnapshot> = bodies.associateBy { it.key }, stepIndex: Long = 0)

Properties

Link copied to clipboard

Flat list of exported body snapshots.

Link copied to clipboard

Pre-indexed lookup map for fast key-to-body access during layout.

Link copied to clipboard

World gravity vector (runtime/world units).

Link copied to clipboard

Whether the simulation is currently paused.

Link copied to clipboard

Convenience view over solver iteration counts.

Link copied to clipboard

Current step configuration (timestep/iteration counts/etc.).

Link copied to clipboard

Monotonic step counter (useful for diagnostics and frame correlation).