I started a new project to wrap Leap.js in THREE.JS;
https://github.com/scottbyrns/THREE.LeapMotion
I know there are leap controls for THREE but this aims instead at making Leap easier to work with inside of any THREE project by building an object structure using THREE vectors instead of 3 element arrays. Within THREE you can perform vector math and projections on the Vector3 object. With this wrapper no work needs to be done to produce THREE ready vectors.
I've added some extras like left hand / right hand detection and closed hand detection.
This wrapper is still in it's early stages but will evolve as I start applying it to my projects. As I'm likely not the only THREE.js dev working with Leap I figured I would share in hopes of finding a collaborator or two.
Going forward I hope to build the logic to easily track hands / fingers with respect to objects within the THREE scene but this first iteration is nothing more than an object model wrapper.
A frame is organized in a slightly different structure than the Leap.js frames and does not include tools as I am more concerned with a plug and play way to reach out and touch 3d objects within THREE. I don't plan to use tools in my projects so I have not included them.
Frame has Hands which have Fingers with Tips; Hands also have a Palm
var leap = new THREE.LeapMotion();
leap.handleFrame = function ( frame ) {
window.currentFrame = frame;
if ( frame.hasHandsVisible() ) {
if ( frame.hasTwoHandsVisible() ) {
if ( frame.getLeftHand().isClosed() ) {
// Left Hand is closed
}
if ( frame.getLeftHand().isUpsideDown() ) {
// Left Hand is upside down
}
}
}
};