/// <summary> /// 记录第一次进入检测的手是左手还是右手. /// 1.枚举为None时 /// 1.1检测到一只手,指定为该手 /// 1.2检测到两只手,指定[0]下标 /// 1.3检测到0只手,指定None /// 2.枚举为Right/Legt时 /// 2.1检测到1只手,指定为该手 /// 2.2检测到2之手,不变 /// 2.3检测到0只收,设定为None /// </summary> void SaveAboveViewHand() { Frame frame = m_LeapCtrl.Frame(); HandList hands = frame.Hands; int count = hands.Count; if (m_AboveView == E_HandInAboveView.None) { if (count == 1 || count == 2) { bool isRight = hands[0].IsRight; if (isRight) { m_AboveView = E_HandInAboveView.Right; } else { m_AboveView = E_HandInAboveView.Left; } } } else { if (count == 1) { bool isRight = hands[0].IsRight; if (isRight) { m_AboveView = E_HandInAboveView.Right; } else { m_AboveView = E_HandInAboveView.Left; } } else if (count == 0) { m_AboveView = E_HandInAboveView.None; } } }
/// <summary> /// 记录第一次进入检测的手是左手还是右手. /// 1.枚举为None时 /// 1.1检测到一只手,指定为该手 /// 1.2检测到两只手,指定[0]下标 /// 1.3检测到0只手,指定None /// 2.枚举为Right/Legt时 /// 2.1检测到1只手,指定为该手 /// 2.2检测到2之手,不变 /// 2.3检测到0只收,设定为None /// </summary> void SaveAboveViewHand() { Frame frame = m_LeapCtrl.Frame(); HandList hands = frame.Hands; int count = hands.Count; if(m_AboveView== E_HandInAboveView.None) { if(count ==1||count==2) { bool isRight = hands[0].IsRight; if(isRight) { m_AboveView = E_HandInAboveView.Right; } else { m_AboveView = E_HandInAboveView.Left; } } } else { if(count==1) { bool isRight = hands[0].IsRight; if(isRight) { m_AboveView = E_HandInAboveView.Right; } else { m_AboveView = E_HandInAboveView.Left; } } else if(count==0) { m_AboveView = E_HandInAboveView.None; } } }