body joints angle using kinect (checking time interval)

断了今生、忘了曾经 提交于 2019-12-04 09:32:46

Would simply using a DispatchTimer for a countdown accomplish what you are wanting to do?

Psuedo-code follows:

private int isArmUpCounter = 5;
private bool isArmUp = false;

private void OnSkeletonReady() {
  if (myArm.Angle > 70 && myArm.Angle < 80)
  {
    if (isArmUp == false)
    {
      isArmUp = true;
      isArmUpCounter = 5;
      armUpTimer.Start();
    }
  }
  else
  {
    if (isArmUp == true && isArmUpCounter > 0)
    {
      Console.WriteLine("You dropped your arm too soon!");
    }

    isArmUp = false;
    armUpTimer.Stop();
  }
}

private void OnArmUpTimerTick() {
    // one a 1 second tick
    isArmUpCounter--;
}

A little tweaking of code certainly needed. But does the concept achieve what you're looking for?

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!