Physics API in Formo
Everything the Physics article covers through the properties panel is also a live API surface: readable and writable directly from a formula, not sealed off from Formo's reactive system once it's running.
Read velocity and angular velocity
Any physics-enabled object exposes .physics.velocity (a Vec2, with .x and .y) and .physics.angularVelocity (a single number, how fast it's currently spinning). Both are live, updating every simulation step, and readable from any formula anywhere in your document, not just on the object itself. Star1.physics.velocity.x in a formula on a completely different object reads that star's current horizontal speed live, the same as referencing any other property cross-object.
Set velocity and angular velocity
Both properties are writable too, not just readable. Set .physics.velocity or .physics.angularVelocity directly from a formula to override the simulation's own result for that step, rather than only nudging it indirectly through forces. This is the more forceful sibling to applyForce/applyImpulse: instead of pushing on the body and letting the solver figure out the resulting velocity, you're setting the velocity itself outright.
Check collisions with collides()
Beyond the collide event covered in the main Physics article, there's a direct, callable query: collides(target), returning a plain boolean for whether this object is currently in contact with a specific other object. This is the right tool for a simple conditional check inline in a formula — "is this touching that, right now" — without setting up a full event handler when all you need is a yes/no read at the moment a formula evaluates.
Apply forces and impulses
The same two methods covered in the main article (applyForce(fx, fy) for a continuous push and applyImpulse(ix, iy) for a single instantaneous kick) are callable from any formula or event handler, not only from inside a collide event. A formula that continuously evaluates some condition on every tick can call applyForce every time it's true, building custom, ongoing forces (a wind zone, a magnet, a repulsion field) driven entirely by your own logic rather than the physics engine's built-in gravity alone.
Drive properties from physics state
Because velocity and angularVelocity are readable from anywhere, they're the natural bridge between "a physics simulation is running" and "something non-physics should react to it." A shape's own scale or opacity, a shader parameter, a color — any of them can be bound to a formula referencing a physics object's current velocity, so a fast-moving object visually stretches, glows, or trails based on its live speed, entirely driven by the simulation rather than hand-keyed to approximate it.