Moving cursor with Leap Motion

Hello everyone,

I have a question which is not exactly a problem, but an improvement to use the Leap Motion, will try to explain ...

Below have a print from one screen to try to better explain the idea, the project aims to position itself as the cursor over the button, after a while the automatic click occurs (such as Xbox) ...

The problem is that as we have above figures on the screen, it takes a lot to raise the arm to be able to position the focus.

The question then is: Is it possible to control this return movement of the mouse, in order to "reduce" the "angle" as the movement? For example instead of raising both hands, with a smaller angle position get further up the screen ...

Obs .: In the viewer that is installed with Leap Motion works well, but the Processing Library, gives "difference", Really raise much your hand to achieve focus.

This is part of the code I'm using to capture the coordinates.

    static class utilPosXY { 
      public static int xPos, yPos;                         //Variáveis para atualização das coordenadas para posições de desenho ( Obs.: Comum para todo o projeto )
      public static de.voidplus.leapmotion.LeapMotion leap; //Objeto Leap Motion ( Controle movimento das mãos )

//Função atualiza variáveis para posicionar coordenadas para desenho, usando algum dispositivo ( Leap Motion, Kinect, etc... )
    static class atualizaVar extends utilPosXY {
      atualizaVar(int x, int y) {
        this.xPos = x;
        this.yPos = y;

      public void atualizaLeap(int opcLeap) {
        for (Hand hand : utilPosXY.leap.getHands ()) {
          // ----- BASICS -----
          if (opcLeap == 1){ //Rastreamento com as mãos 
            PVector hand_stabilized  = hand.getStabilizedPosition();

            this.xPos = int(hand_stabilized.x);
            this.yPos = int(hand_stabilized.y);
          } else if (opcLeap == 2){ //Rastreamento com o dedos
            for (Finger finger : hand.getFingers ()) {
              // Alternatives:
              // hand.getOutstrechtedFingers();
              // hand.getOutstrechtedFingersByAngle();

              // ----- BASICS -----
              int     finger_id         = finger.getId();
              PVector finger_position   = finger.getPosition();
              PVector finger_stabilized = finger.getStabilizedPosition();
              PVector finger_velocity   = finger.getVelocity();
              PVector finger_direction  = finger.getDirection();
              float   finger_time       = finger.getTimeVisible();

              // ----- SPECIFIC FINGER -----
              switch(finger.getType()) {
                case 0:
                  // System.out.println("thumb");
              case 1:
                this.xPos = int(finger_stabilized.x);
                this.yPos = int(finger_stabilized.y);
              case 2:
                // System.out.println("middle");
              case 3:
                // System.out.println("ring");
              case 4:
                // System.out.println("pinky");

Comments are in Portuguese ... i thought I'd try to use the map function, but I wonder if anyone can suggest something ... thank you!tela_vide01


Sign In or Register to comment.