LeapMotion C # get skeleton coordinates __c#

Source: Internet
Author: User

I just use the console application to say it.

Getting the coordinates is the rewriting of his own listener Onframe event.

It is best not to use Console.WriteLine When overriding listener because he is using multiple threads, direct use can cause thread conflicts.

Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Text;

Using Leap; Namespace ConsoleApplication6 {class Program {static void Main (string[] args) {Cont
            Roller leap = new Controller ();
            Alistener listener = new Alistener (); Leap.
            AddListener (listener); Console.WriteLine (Leap.
            Devices[0]);
            Console.WriteLine ("Press Enter to quit ...");    Console.ReadLine (); Keep this process running until the Enter is pressed leap.
            RemoveListener (listener); Leap.
        Dispose ();
        } public class Alistener:listener {Object thislock = new Object (); void Safewriteline (string line) {Lock (Thislock) {Console.WriteLine
            );
        } public override void OnConnect (Controller arg0) {safewriteline ("conectted"); } PubLic override void Onframe (Controller arg0) {Frame frame = arg0.
            Frame (); Handlist hlist = frame.
            hands;
            Hand hand1 = hlist[0]; Safewriteline (Hand1. Palmposition.x.tostring () + "" + hand1. Palmposition.y.tostring () + "" + hand1.
            Palmposition.z.tostring ());
            Hand hand2 = hlist[1]; Safewriteline (Hand2. Palmposition.x.tostring () + "" + hand2. Palmposition.y.tostring () + "" + hand2.

            Palmposition.z.tostring () + "\ n"); Safewriteline (arg0. Frame ().
        Id.tostring ());
        public override void OnInit (Controller arg0) {safewriteline ("Inti");
 }
    }
}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.