Skip to content

Packs / xr-glasses-and-headsets-public

webxr-hand-tracking

Show the user's tracked hands (25 joints each) in a WebXR scene and detect a pinch, with a simulated hand outside a headset for testing

Install

logicpacks pack use xr-glasses-and-headsets-public/webxr-hand-tracking
get_pack xr-glasses-and-headsets-public/webxr-hand-tracking

The second line is the MCP tool call for the LogicPacks connector (Claude Code, Codex, Claude.ai and others). The first run of a pack someone else wrote asks for your yes.

Keys it needs (names only)

None.

Playbooks included

  • Spec: spec/SPEC.md (goal, steps, edge cases, don’ts)
  • Routes: static-local
  • Checks: 1 in outcome/checks.yaml
  • Code: hand.jsonindex.htmlmain.js
  • Tools: python3, playwright-python, chromium

Usage, last 8 weeks

New: no recorded use yet.

Purpose (from spec/SPEC.md)

Goal

Hand joints drawn every frame from XRHand, a pinch gesture (thumb tip to index tip under 2 cm) firing events, and the same code testable headless with recorded joint data.

Steps

  1. Request hand-tracking as an optional feature (see webxr-session-starter).
  2. Each frame read 25 joint poses per hand with frame.getJointPose (three.js: renderer.xr.getHand(i).joints).
  3. Pinch = distance(thumb-tip, index-finger-tip) < 0.02 m with hysteresis (release above 0.035 m).
  4. Outside XR the page plays fixtures/hand.json (25 joints) through the same drawing and pinch code.
  5. Check: python3 ../tools/webgl_check.py code --js "window.__hand.joints === 25".

Edge cases

  • Joint order follows the WebXR Hand Input spec (wrist first, then thumb to little finger).
  • Tracking drops when hands leave the cameras' view: fade joints instead of snapping.

Don'ts

  • Don't rely on hand tracking only: support controllers too.
  • Don't store or upload raw hand data (biometric-like).