0

Hi everyone I've got the following code block

using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame())
{
    if (skeletonFrame != null)
    {
        Skeleton[] skeletons = new Skeleton[skeletonFrame.SkeletonArrayLength];
        skeletonFrame.CopySkeletonDataTo(skeletons);
        foreach (Skeleton skeleton in skeletons)
        {
            if (skeleton.TrackingState == SkeletonTrackingState.Tracked)
            {
                //DoSomething();
            }
            else if (skeleton.TrackingState == SkeletonTrackingState.NotTracked)
            {
                //DoSomethingElse();
            }
        } 
    }
}

My plan is to call a method that says player detected when a player is tracked. And the contrary when no one is tracked. In essence using the Kinect for motion detector (only human I know). But as it appears this loop is not working correctly for me. With the help of debugger I can see that I do get inside the DoSomething(); But thats where its get stuck and keeps repeating the same message that DoSomething() supposed to do even when the player leaves. Any idea why is this happening and how to accomplish this?

AGB
  • 2,230
  • 1
  • 14
  • 21
envyM6
  • 1,099
  • 3
  • 14
  • 35
  • Or is there a way to create an event to fire an event when a player tracked status is changed? – envyM6 Apr 26 '16 at 23:18
  • Possible duplicate of [Kinect SDK player detection](http://stackoverflow.com/questions/10562554/kinect-sdk-player-detection) – 16per9 Apr 27 '16 at 09:32

0 Answers0