class Bone()

The Bone class represents a tracked finger bone.

Note that Bone objects can be invalid, which means that they do not contain valid tracking data and do not correspond to a physical entity. Invalid Bone objects can be the result of asking for a Bone object from an invalid finger or hand. A Bone object created from the Bone constructor is also invalid.

New in version 2.0.

classmethod Leap.Bone()

Constructs a Bone object.

Get valid Bone objects for fingers from a Finger() object. Get the Bone object for a forearm from Hand.arm.

Return type:Bone

New in version 2.0.

Type:number[][] – a 2-dimensional array, with each dimension containing three elements.

The orthonormal basis vectors for this Bone.

var basis = bone.basis;

Basis vectors specify the orientation of a bone.

  • basis[0] – the x-basis. Perpendicular to the longitudinal axis of the bone; exits the sides of the finger or arm.
  • basis[1] – the y-basis or up vector. Perpendicular to the longitudinal axis of the bone; exits the top and bottom of the finger or arm. More positive in the upward direction.
  • basis[2] – the z-basis. Aligned with the longitudinal axis of the bone. More positive toward the base of the finger or elbow of the arm.

The bases provided for the right hand use the right-hand rule; those for the left hand use the left-hand rule. Thus, the positive direction of the x-basis is to the right for the right hand and to the left for the left hand. You can change from right-hand to left-hand rule by multiplying the basis vectors by -1.

You can use the basis vectors for such purposes as measuring complex finger poses and skeletal animation. The matrix() function converts the basis and bone positions to a transformation matrix that can be used to update a 3D object representing the bone in a 3D scene.

Note that converting the basis vectors directly into a quaternion representation is not mathematically valid. If you use quaternions, create them from the derived rotation matrix not directly from the bases.

New in version 2.0.


The length of the bone in millimeters.

var length = bone.length;

New in version 2.0.


The distal end of the bone closest to the finger tip.

var bone_end = bone.nextJoint;

New in version 2.0.


The proximal end of the bone closest to the torso.

var bone_start = bone.prevJoint;

New in version 2.0.

Type:integer – a code indicating the bone name

The code for the anatomical identity of this bone:

  • 0 = Metacarpal
  • 1 = Proximal phalanx
  • 2 = Intermediate phalanx
  • 3 = Distal phalanx
  • 4 = forearm
var bone_names = ["metacarpal", "proximal phalange", "intermediate phalange", "distal phalange"];
var type = bone.type;
var name = bone_names[type];

New in version 2.0.


The average width of the fleshy part surrounding this bone.

var average_width = bone.width;

New in version 2.0.

The midpoint of this bone in millimeters within the Leap Motion coordinate system.

var center =;


The three element array representing a position midway between the bone end points.

New in version 2.0.


The direction vector along the bone’s longitudinal axis.

var direction = bone.direction();

This is the negative of the bone’s z-basis (Bone.basis[2]).


The a 3-element array (number[]) containing the coordinates of the direction vector.

New in version 2.0.


Reports whether this bone is associated with the left hand.

Bones on the left hand use the left-hand rule; those on the right use the right-hand rule.

    var right_hand_basis = [Leap.vec3.negate(Leap.vec3.create(), bone.basis[0]),
                            Leap.vec3.negate(Leap.vec3.create(), bone.basis[1]),
                            Leap.vec3.negate(Leap.vec3.create(), bone.basis[2])];


True, if the bone is associated with the left hand.

New in version 2.0.

Bone.lerp(out, t)


  • out (number[]) – A 3-element array which will be set to the interpolated position. (Create with Leap.vec3.create().)
  • t (number) – A value between 0 and 1 specifying the relative distance between the base (0) and the end of the bone (1).

Calculates the coordinates of the point between the ends of the bone in millimeters from the Leap Motion origin by linearly interpolating between the end points of the bone. If the t parameter is set to 0, the position corresponds to the prevJoint; if set to 1, the position corresponds to nextJoint.

var quarter_point = Leap.vec3.create();
bone.lerp(quarter_point, .25);


Does not return a value; sets the out array instead.

New in version 2.0.


The transformation describing the bone orientation and position within the Leap Motion coordinate system.

var bone_transform = bone.matrix();

You can use this matrix to transform a 3D or skinned-animation bone object within a 3D scene.

Calculated from the bone’s basis and center().


A 4x4 matrix stored in row-major order within a 16-element array of floating point numbers.

New in version 2.0.