This script creates super handy callbacks for hand tracking - whether it's on mobile, Spectacles, or emulating using tap & hover in the preview panel!
On Spectacles, this should be combined with Spectacles Interaction Kit.
twitter (@maksvanleeuwen)
(This script needs LSQuickScripts in your project in order to work.)
Bind using .add(f)
and .remove(f)
.
Bind to HandTracking
, for example: HandTracking.onPinchStart.add( function(pos, isTap){} )
.
.onPinchStart
→ (pos
,isTap
).onPinchHold
→ (pos
,isTap
).onPinchEnd
→ (pos
,isTap
).onTrackStart
→ (isTap
).onTrackEnd
→ (isTap
).onActiveHandChange
→ (prvHand
,curHand
)
.getActiveHand()
→Hand
.getDominantHand()
→Hand
.getPinching()
→bool
.getPinchPosition()
→vec3
.getPinchForward()
→vec3 (normalized)
.getPinchUp()
→vec3 (normalized)
.getHoverScreenPosition()
→vec2
.getHoverWorldPosition()
→vec3
pos
: positionvec3
, world spaceisTap
: bool if emulated (preview panel tapping instead of pinch)Hand
: string ('left'|'right')