Created
February 17, 2014 02:31
-
-
Save codingricky/9043706 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.github.codingricky.leapmotion; | |
import com.leapmotion.leap.Controller; | |
import com.leapmotion.leap.Hand; | |
import com.leapmotion.leap.Listener; | |
public class LeapMotionListener extends Listener { | |
private float x; | |
@Override | |
public void onFrame(Controller controller) { | |
final Hand hand = controller.frame().hands().get(0); | |
if (hand.palmPosition().isValid()) { | |
x = hand.palmPosition().getX(); | |
} else { | |
x = 0; | |
} | |
} | |
public float getX() { | |
return x; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment