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?