Physics
Real rigid-body physics, running on a physics engine underneath. Drop it onto any shape, and gravity, collisions, and forces play out live on the canvas, fully reversible the moment you stop playing, and fully reachable from Formo's reactive formula system when you need something beyond the default simulation.
Add physics to a shape
Select an object, and click the Modules Add button in the properties panel — it opens a dropdown of available modules, with Physics as one of them. Pick it, and the object gets a physics body immediately, with a full set of properties appearing right below it in the panel.
Nothing moves yet just from adding the module, though: physics only runs during Play. While you're editing, a physics-enabled object stays exactly where you put it, so setting up a scene full of physics objects doesn't turn into a falling mess the moment you attach the module; the simulation only starts once you press play.
Body type: dynamic, static, and kinematic
A three-way toggle sets how the object participates in the simulation:
- Dynamic: fully simulated. Gravity pulls it, collisions push it, forces you apply move it — a physical object, the default and the one you'll use for anything that should fall, bounce, or get knocked around.
- Static: never moves, but other objects still collide against it. The floor, a wall, anything meant to be an immovable obstacle other things interact with.
- Kinematic: moves, but only exactly the way you tell it to (by animating its position directly, with a keyframe or a formula); it's not affected by gravity or collisions itself, while still able to push dynamic objects it runs into. A platform that slides back and forth on a fixed path, carrying whatever's standing on it, is the classic kinematic use case: it needs to move on a schedule you control, but still needs to physically interact with everything riding on it.
Switching an object's body type is a live change to its physics behavior, not a one-time choice locked in when you first add the module. Flip a platform from static to dynamic mid-scene, for instance, and it starts falling from that point on.
Set mass and gravity
Mass: labeled plainly as "Mass" in the panel, though under the hood it's actually a density value (0 to 100) the physics engine uses to compute the object's real mass from its size. Two shapes with the same Mass setting but very different sizes won't weigh the same in the simulation: a large shape at a given density has more mass than a small one at the same setting, exactly the way real material density works.
Gravity Scale: how strongly gravity affects this specific object, independent of every other object in the scene, ranging from -10 to 10. The default is 1 (normal gravity); push it toward 0 for something that barely falls, or into negative numbers for something that actively floats upward instead of down — a balloon, a bubble, anything that should behave like it's lighter than air, sitting right alongside heavier objects using the ordinary positive value.
Configure friction, restitution, and colliders
A few settings are tucked away by default since most objects never need to touch them, but they're fully adjustable, and worth knowing about once the basics aren't enough:
- Friction (0 to 1): how much a surface resists sliding against another. Low friction lets things slide freely past each other, like ice; high friction makes them grip and stop almost immediately on contact, like rubber.
- Restitution (0 to 1): bounciness. Low restitution means an object stops dead on impact, absorbing the hit completely; high restitution means it rebounds, potentially even higher than it started, like a superball.
- Collider: the actual collision shape used for physics, separate from how the object visually looks on screen. Auto picks a sensible default based on the object's type (a box shape for a rectangle or frame, for instance); you can force Circle, Box, or Capsule explicitly instead when the automatic choice doesn't match the collision shape you want. A capsule collider on a tall, rounded-end shape often reads much more naturally than a box would, for example.
Reacting to collisions
Physics objects can trigger a collide event: the same Events system covered in the Shapes article, not a separate physics-only mechanism. Attach a collide handler to an object, and it fires whenever that object's physics body hits something, with detailed collision data available inside the handler:
- target: a direct reference to the other object involved in the collision, not just the fact that a collision happened. You can read that object's own properties, or act on it directly, right from the handler.
- targetId: that same other object's identifier, if you need the id specifically rather than the object reference.
- collider and targetCollider: which collider shape was involved on each side of the impact.
- normal: the direction of the impact, as an x/y vector.
- point: exactly where in the scene the contact happened, in real world pixel coordinates.
This is rich enough to build reactive collision behavior: check which specific object you hit, look at where exactly the impact landed, and respond differently depending on the answer — a ball that changes color only when it hits a particular target, for instance, rather than reacting identically to every collision.
Pushing an object programmatically
Beyond letting gravity and collisions do all the work, a physics body can be pushed directly from a formula or an event handler with two callable methods:
- applyForce(fx, fy): a continuous push, applied every simulation step for as long as you keep calling it — the physics equivalent of a steady wind or a rocket thruster.
- applyImpulse(ix, iy): a single, instantaneous kick, the physics equivalent of a hit or a sudden shove, applied once and then gone.
Calling one of these from inside a collide handler is exactly how you'd build something like a bumper that actively launches whatever hits it, rather than just passively bouncing it off with restitution alone.
Reading physics state from a formula
Physics isn't sealed off from the rest of Formo's reactive system in the other direction either: an object's own physics state, including its current velocity, can be read directly from a formula, the same way any other property can. This means something else in your document can react live to how fast a physics object is currently moving — driving a motion-blur-style stretch off velocity, for instance, or triggering a sound effect only once something's falling fast enough to matter.
Physics and the timeline
Like everything else that happens during Play, physics is non-destructive: press play, and physics runs live, objects falling and colliding for real. Press stop, and everything snaps back exactly to how it was before you pressed play. Nothing a collision knocked over or a force pushed away stays moved unless you specifically keyframed that result. This makes experimenting with physics settings safe by default: nudge Gravity Scale, hit play, watch what happens, hit stop, and try again from the same clean starting point, as many times as it takes to get the feel right.