Skip to content

Instantly share code, notes, and snippets.

@codingricky
Created February 17, 2014 02:31
Show Gist options
  • Save codingricky/9043706 to your computer and use it in GitHub Desktop.
Save codingricky/9043706 to your computer and use it in GitHub Desktop.
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