haathWebXR

Open source · MIT · v0.0.4

WebXR hand tracking and gestures, in one update() call.

haath is a zero-dependency JavaScript library that turns WebXR hand joints into game input: finger signs, punches and slaps, claps, circles, and two-hand spells. Built for Meta Quest and battle-tested in DunJun.

npm i @treefour/haath

Live demo

No headset needed. These are synthetic 25-joint hands going through the real haath engine via updateFromPoses(), in your browser.

Left hand

Right hand

Motion

Loading haath…

What haath detects

Finger signs

Fist, open palm, palm up and down, finger gun, poke, pinch, thumbs up and down, horns, shaka, and more, from bone-segment curl that works at any hand size or angle.

Punch and slap

Velocity-gated strikes with real m/s speed and a velocity vector, so hits carry momentum.

Whole-hand hits

Palm, wrist, fingertip, and swept-palm collision against targets, with per-target cooldowns. Fast hands cannot tunnel through.

Two-hand gestures

Double clap, hands crossed, finger counting from 0 to 10, triangle laser, and a charged two-palm blast.

Spells

3D circle traces in any plane, fitted with Newell's method, plus laser and disc hit helpers.

Menus and tools

Hold-to-confirm timers, a debug overlay, a PC hand emulator, and a v2 engine with ASL poses and micro-gestures.

Ten lines to a punch

One instance, one call per frame. Everything else is a field read.

import { Haath } from '@treefour/haath';

const haath = new Haath();

renderer.setAnimationLoop((_t, frame) => {
  if (frame) {
    const xr = renderer.xr;
    const state = haath.update(frame, xr.getReferenceSpace(), xr.getSession()?.inputSources, dt);
    if (state.right.gesture === 'punch') hit(state.right.velocity);
    if (state.twoHand.clap.doubleClap) pause();
  }
  renderer.render(scene, camera);
});

Works with your engine

haath reads the standard WebXR XRFrame and XRHand API and never imports an engine.

Built for 90 Hz on a phone chip

Zero allocations

The per-frame path allocates nothing. State is reused, so there are no garbage collection hitches mid-punch.

Zero-frame latency

Runs on the main thread in the same XR frame. No worker round trip, no dropped contacts.

Zero dependencies

No engine, no physics library, no pose files to download. TypeScript types and ESM plus CJS builds.

How the math works

Questions

What is haath?

haath (npm package @treefour/haath) is an open-source JavaScript and TypeScript library for WebXR hand tracking and gesture recognition. It reads the standard WebXR hand joints each frame and reports finger signs, punches, slaps, claps, circles, and two-hand gestures.

Is haath related to Hardhat?

No. Hardhat is an Ethereum development tool. haath is a WebXR hand tracking library by Tree Four Studio. The name means "hand" in Hindi and Urdu.

Can I test without a headset?

Yes. updateFromPoses() runs the full pipeline on recorded or synthetic joints, and the PC hand emulator adds keyboard-driven hands to IWER in a desktop browser.

Is it free for commercial use?

Yes. haath is MIT licensed.

All questions

haath powers every punch, slap, spell, and menu in DunJun, a hand-tracked WebXR brawler on Meta Quest, built by Tree Four Studio.