haathWebXR

Why haath

Most WebXR hand libraries stop at static pose detection. haath also handles motion, two-hand geometry, and hit testing, with the same per-frame budget.

Geometry instead of templates #

Template libraries compare live joints against recorded wrist-relative snapshots. Hand size, wrist tilt, and punch angle make that distance drift, which causes misses. haath uses the hand's own geometry:

  • Finger curl from bone segments. A finger counts as extended when its consecutive bone vectors (metacarpal to tip) point the same way (dot > 0.6). This does not change with hand rotation, camera angle, or arm reach.
  • Self-normalizing thumb test. The thumb is out when the thumb tip is farther from the middle finger than the palm is wide. The player's own palm is the ruler, so it works for any hand size.
  • Pinch guard. Pinch requires a curled index, so a pointing or gun finger never misfires as a pinch.

Zero-frame strike latency #

Physics engines in a Web Worker return results a frame or two later and can drop contact events across the worker boundary. haath runs on the main thread inside the same XRFrame: it samples joint poses, computes velocity, resolves hits, and records momentum before the frame renders.

Motion and two-hand math #

  • Velocity gate. Speed is sampled at the ring finger tip, which captures arm swing and wrist whip. A fist above 1.3 m/s is a punch, an open hand above 1.8 m/s is a slap.
  • Triangle laser. Both index tips and thumbs define a 3D plane. The beam follows its normal, locked to point away from the player, so players aim by tilting their hands.
  • Occlusion-proof double clap. Fast claps hide one palm from Quest cameras. Separate contact and release distances keep the detector stable through that.
  • Circles in any plane. A 90-frame wrist history is fit to a 3D plane with Newell's method, checked for roundness, and the swept angle is integrated. Vertical, flat, and tilted circles all count.

Battle-tested #

haath came out of DunJun, a hand-tracked WebXR brawler on Meta Quest, where it runs every punch, slap, spell, and menu.

Last updated 2026-11-16