Beispiel #1
0
 /// <summary>
 /// 是否双手合十
 /// </summary>
 /// <param name="oherHand"></param>
 /// <returns></returns>
 public bool IsHandsTogether(GestureRecognize_OneHand otherHand)
 {
     if ((otherHand.GetPalmPosition() - hand.PalmPosition).Magnitude < deltaClosePalm)
     {
         if (this.isFullOpening && otherHand.isFullOpening)
         {
             return(true);
         }
     }
     return(false);
 }
Beispiel #2
0
    private bool IsQigongGesture(GestureRecognize_OneHand otherHand)
    {
        //手腕接近
        if (!((otherHand.GetWristPosition() - this.GetWristPosition()).Magnitude < deltaQigongPalm))
        {
            return(false);
        }
        //手成抓取状态
        if (!this.IsGrabHand() || !otherHand.IsGrabHand())
        {
            return(false);
        }

        Vector3 vec1 = new Vector3(
            otherHand.GetPalmDir().x,
            otherHand.GetPalmDir().y,
            otherHand.GetPalmDir().z);
        Vector3 vec2 = new Vector3(
            this.GetPalmDir().x,
            this.GetPalmDir().y,
            this.GetPalmDir().z);
        float anglePalm = Vector3.Angle(vec1, vec2);       //手掌方向夹角

        //手掌方向相近
        if (!((anglePalm < angleQigongPalmMax) && (anglePalm > angleQigongPalmMin)))
        {
            return(false);
        }
        //手方向相反
        vec1 = new Vector3(
            otherHand.GetHandDir().x,
            otherHand.GetHandDir().y,
            otherHand.GetHandDir().z);
        vec2 = new Vector3(
            this.GetHandDir().x,
            this.GetHandDir().y,
            this.GetHandDir().z);
        float angleHand = Vector3.Angle(vec1, vec2);     //手掌方向夹角

        if (!((angleHand < -angleQigongHandMin) || (angleHand > angleQigongHandMin)))
        {
            return(false);
        }
        return(true);
    }