Configuration
Every threshold is optional. The defaults are the values DunJun ships with.
const haath = new Haath({
punchSpeed: 1.3, // m/s, fist promoted to 'punch'
slapSpeed: 1.8, // m/s, open hand promoted to 'slap'
pinchDist: 0.03, // m, thumb tip to index tip
curlDot: 0.6, // bone-segment dot product above which a finger counts as extended
useCurlDetection: true,// false = legacy wrist-to-tip distance mode
thumbOpenDist: 0.07, // legacy mode only
fingerOpenDist: 0.10, // legacy mode only
directionThreshold: 0.72, // thumbs up/down, palm up/down split
minBoneLength: 0.03, // m, rejects collapsed / garbage tracking frames
// two-hand
triangleTipDist: 0.12, triangleThumbDist: 0.14, triangleFingerDot: 0.35,
clapContactDist: 0.17, clapSeparationDist: 0.195, clapOriginMinDist: 0.05,
clapDoubleMinMs: 90, clapDoubleMaxMs: 1100,
// circle
circleHistoryFrames: 90, circleMinSamples: 30, circleMinRadius: 0.06,
circleMaxIrregularity: 0.55, circleMinRevolutions: 1.2, discFireCooldownMs: 800,
// blast
blastPalmDist: 0.30, blastForwardDot: -0.4, blastChargeDurationMs: 600,
blastThrustSpeed: 1.0, blastCooldownMs: 800,
});Exported constants #
All defaults are also exported as constants, for example PUNCH_SPEED, SLAP_SPEED, PINCH_DIST, and CLAP_CONTACT_DIST. The joint layout is exported as XR_HAND_JOINTS (the 25 WebXR joint names in order) and JOINT_INDEX (name to index).
Tuning tips #
- Lower
punchSpeedfor seated or casual games. Raise it if idle fists read as punches. - Raise
pinchDistslightly for users with large hands or noisy tracking. circleMinRevolutionsbelow 1.0 makes circles easy to trigger by accident.