Fingers:
Positions of the tips of the fingers:
//finger from 0 to 4 are, in order: thumb, index, middle, ring and pinky
frame.fingers[0].tipPosition
- thumb …
- index …
- middle …
- ring …
- pinky …
The positions can be used to compute distances between the tips.
distance = function(a,b) {
var x = a[0]-b[0]
var y = a[1]-b[1]
var z = a[2]-b[2]
x *= x
y *= y
z *= z
return Math.sqrt(x+y+z)
}
distance(frame.fingers[0].tipPosition, frame.fingers[1].tipPosition);
Distance between the tip of the finger and thumb: …
Hands
Position of the Palm of the hand
frame.hands[0].palmPosition;
Position of the first hand:
Type of hand (right/left):
frame.hands[0].type;
First hand I’ve seen is:
Indication of pinch:
frame.hands[0].pinchStrength;
MacOS/Linux and Windows have a very different interpretation of pinch. For Windows a two finger pinch will put the index close to 1, for MacOS and Linux a closed fist will be required.
Pinch index:
To investigate other information available, which depends on the version of the Leapmotion software you are running, you can dump the “hands” info to the console.
console.log(frame.hands[0])