physics — Luau Binding

require("physics"): turn targets into bodies, apply forces and impulses, and let the stage's fixed tick simulate them deterministically. The programmatic surface of the opt-in physics layer. Every function is [antos].

Status: design. Not built yet.

local physics = require("physics")

Bodies

Call Returns Does
physics.body(target, opts?) ok make target a body. opts = { kind = "dynamic", mass = 1, restitution = 0, friction = 0.3 } — kind is "dynamic" / "static" / "kinematic"
physics.remove(target) ok back to a plain, animation-driven target
physics.gravity(x, y) ok the world force applied to every dynamic body

Forces and velocity

Call Returns Does
physics.force(target, fx, fy) ok apply a continuous force this tick
physics.impulse(target, ix, iy) ok apply an instantaneous impulse — a launch, a jump
physics.velocity(target, vx?, vy?) vx, vy read velocity, or set it when given
local physics = require("physics")
physics.gravity(0, 900)
physics.body(ground, { kind = "static" })
physics.body(crate,  { kind = "dynamic", mass = 2, restitution = 0.2 })
-- crate now falls, lands on ground, and settles — deterministically
physics.impulse(crate, 0, -1200)     -- ...give it a bounce

Where to go next

  • Bodies, the Resolve phase, and the determinism discipline → physics
  • The detector it consumes → collision · the fixed tick → stage

Important: The Ant64 family of home computers are at early design/prototype stage, everything you see here is subject to change.