Back to the live demo

Open source, 2026

Sweatstick

Turning a webcam into a game controller, so that playing is the workout. Run in place to move, lean to steer, hop to jump.

Narrow on purpose

The pitch isn't "control games with gestures". It's make the effort real. Forward motion only happens if you're actually running in place, and it's a rate rather than a switch: jog harder and you move faster.

A Fall Guys race round is about two minutes of near-constant forward input. So you end up doing two-minute intervals whether you planned to or not.

  1. Webcam640x480
  2. MediaPipe Pose~30fps on CPU
  3. Intentspure, no I/O
  4. Virtual gamepadViGEmBus
  5. Gamesees an Xbox pad
The only layer that knows anything about bodies is the one in the middle, and it imports no camera and no gamepad.

The controls

MovementHow it's detectedOutput
Lean torso left or rightShoulder midpoint offset from hip midpointLeft stick X
Run in placeAlternating knee lift, measured as cadenceLeft stick Y
HopHip midpoint rises above its rolling baselineA, jump
Both arms up and wideWrists above shoulders, hands wider than shouldersX, dive
Both hands on head, 1sWrists above nose, hands close togetherPause toggle

Three decisions everything else follows from

Emit a gamepad, not keypresses

Most games ignore pyautogui-style synthetic input entirely. Even where keys do land, you get binary left or right instead of the analog stick that makes steering playable. A virtual Xbox pad through ViGEmBus fixes both, and the game swaps its button prompts to Xbox glyphs as confirmation that it bound.

Measure against the body itself

Every distance is divided by torso length, so a lean of 0.25 means the same thing at two metres from the camera as at four. That's why there's no calibration step to forget to run.

Keep the mapping layer pure

The code that turns landmarks into controller intents imports neither OpenCV nor the gamepad library. Every threshold and state machine is tested with hand-written skeletons on any machine, with no camera, no driver and no game running.

Cadence from intervals, not a window

The obvious way to measure running speed is to count steps in the last couple of seconds. It's also wrong in a way that matters: counting events in a window overestimates by roughly one over the window length, which is enough to creep forward while barely moving. Sweatstick measures the time between steps instead and averages the last four.

True rate1.00
Steps counted in a 2s window1.50
Mean interval between steps1.00
Both estimators run on the same steady march of one step a second. These numbers are computed when this page is built, using the TypeScript port of the step counter.

Two more rules keep it honest:

  • Alternation is required. The same knee twice is a bounce or a tracking wobble, not a stride, so one twitchy leg can't drive you off a ledge.
  • Hysteresis. A knee counts as lifted at 0.1 torso lengths and has to drop below 0.05 before it can step again.
  • Stopping stops you. If no step lands for 0.9s, cadence goes to zero instead of coasting.

The whole tuning job is one tension

A hop is your hips rising above a slow-moving baseline of where they've been sitting. The baseline drifts with you as you move closer to the camera or settle into a crouch, so only a fast rise counts.

The catch: your hips bob while you run in place. If that bob crosses the jump threshold you jump constantly. The threshold has to be high enough to ignore the bob and low enough to catch a real hop. The default is0.18; if a 30-second run isn't clean, raise it to 0.22, then 0.25.

That tension is the whole tuning job.

So the HUD is a tuning instrument, not decoration. Each meter has a white tick at its threshold, and tuning is watching whether a bar crosses its tick. The meters at the top of this site's homepage work the same way.

Pause is a gesture for a reason

Gamepad input follows window focus. Once Fall Guys has focus, the preview window can't receive a keystroke, so a gesture is the only way to stop the stick mid-match without alt-tabbing. Hands on head for a second toggles it. Releasing re-arms the toggle, or holding your hands up would flip pause on and off once a second. And the dive gesture requires arms wide specifically, so it can never be mistaken for the pause.

Small things that bit

  • The first jump got swallowed. Cooldowns initialised to zero eat the very first gesture when the clock starts at zero. Invisible under a real monotonic clock, wrong in any test that starts at t=0. They start at negative infinity now.
  • A test hop has to move the whole body. Lowering only the hips shortens the torso, and since hip height is normalised by torso length, that reads as the hips moving down.
  • 640x480 on purpose. MediaPipe downsamples internally, so higher capture resolution buys almost nothing while heating a phone-as-webcam until it throttles to black frames.
  • Opening a camera isn't the same as it working. Windows' default backend opens fine on many laptop webcams and then never delivers a frame, so there's a command that tries every index and backend and reports which ones actually produce an image.
  • A dropped detection stops you. Lose the body or freeze the stream and the stick goes neutral immediately. A frozen frame must never leave you sprinting off a ledge.

The version on this site

The camera mode on the homepage runs a TypeScript port of the intent engine, with the same defaults, and a port of its test suite passes against it. The frame is mirrored before measuring, the same as the original, so leaning right reads as right. Nothing leaves the browser tab.

On this page

Pages

Write-ups

Actions

Elsewhere

amanmohammed.xyz↑↓ move↵ select