Hello Team Leap Motion,
I am using SDK 3.2 and I was able to get Hand co-ordinates using a Mouse click event.
but I don't want the data on mouse click event, rather whenever the service is connected, it should display data on the form.
What event should I include my code in so that it runs desired ?
Here is the code I am writing for sample :
public partial class Form1 : Form
{
// Initialize the Controller object which connects to the Leap motion service
// and captures the hand tracking data
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
Application.Exit();
}
public void OnFrame(object sender, FrameEventArgs args)
{
Controller controller = new Controller();
//Get the most recent tracking data using the Frame object
Frame frame = controller.Frame();
for (int h = 0; h < frame.Hands.Count; h++)
{
// Initialize the Hand in the given frame
Hand leapHand = frame.Hands[h];
// Get the "Pointer" finger of current hand which refers to where a person is pointing
Finger leapFinger = leapHand.Fingers[1];
// Prepare a vector which will store the co-ordinate values of the tip of the pointer
Vector currentPosition = leapFinger.StabilizedTipPosition;
textBox1.Text = Convert.ToString(currentPosition.x);
textBox2.Text = Convert.ToString(currentPosition.y);
textBox3.Text = Convert.ToString(currentPosition.z);
}
}
}
}
I am stuck in my project, I would appreciate your response.