Esempio n. 1
0
        //public static Queue<float>[] footDowns = new Queue<float>[2];
        public static bool FootDown(Vector3 firstVet, int index, Vector3 secondVet)
        {
            if (foots[index].Count < footsize)
            {
                return(false);
            }

            float firstFiveFrame = 0;
            float endFiveFrame   = 0;

            float[] footArray = foots[index].ToArray();

            for (int i = 0; i < footArray.Length; i++)
            {
                if (i < footsize / 2)
                {
                    endFiveFrame += footArray[i];
                }
                else
                {
                    firstFiveFrame += footArray[i];
                }
            }

            firstFiveFrame = firstFiveFrame * 2 / footsize;
            endFiveFrame   = endFiveFrame * 2 / footsize;

            float adjust = lengthShoulder / 12;

            if (ARGlobalDefs.IsIosPlatform())
            {
                adjust = lengthShoulder / 18;
            }
            ARDebug.Log("LiftDown adjust == " + adjust);
            ARDebug.Log("LiftDown endFiveFrame == " + endFiveFrame);
            ARDebug.Log("LiftDown firstFiveFrame == " + firstFiveFrame);
            ARDebug.Log("dowaLiftDown ffffirstVet.y == " + firstVet.y);
            float AdjustHeight = adjust * 2;

            if (ARGlobalDefs.IsIosPlatform())
            {
                AdjustHeight = adjust * 3;
            }
            if ((endFiveFrame - firstFiveFrame) > adjust && Math.Abs(firstVet.y - secondVet.y) < AdjustHeight)
            {
                ARDebug.Log("dowaddLiftDownfff datas footDown Dwon i = " + index);
                return(true);
            }
            return(false);
        }
Esempio n. 2
0
        /// <summary>
        /// 检测双掌在胸前左手
        /// </summary>
        /// <returns><c>true</c>, if in waist was fisted, <c>false</c> otherwise.</returns>
        public static bool fistFrontChestLeft(Vector3 Wrist, Vector3 elbow, Vector3 shoulder, Vector3 lHip)
        {
            bool ret = false;

            int yAdjust = (int)(lengthShoulder / 18);

            float xDis = shoulder.x - elbow.x;

            if (ARGlobalDefs.IsIosPlatform())
            {
                if (ARScreen.Instance.IsFrontCamera)
                {
                    xDis = -xDis;
                }
            }
            //shoulder和Elbow不在一条直线上
            if (xDis < yAdjust)
            {
                ARDebug.Log("lashen  error");
                return(false);
            }
            //shoulder和elbow不在一起
            if (Math.Abs(shoulder.y - Wrist.y) < yAdjust / 2)
            {
                ARDebug.Log("lashen chayao front no Check");
                return(false);
            }

            float lLength = shoulder.y - lHip.y;

            if ((Wrist.y - lHip.y) < lLength / 1.7)
            {
                ARDebug.Log("Mydatasl Wrist 太低");
                return(false);
            }

            if (fistFrontToLeft(Wrist, elbow, shoulder, lHip))
            {
                ARDebug.Log("lashenqqq Wrist 太高");
                return(false);
            }
            float angle = GetAngle(Wrist, elbow, shoulder);

            if (angle < 180)
            {
                return(true);
            }

            return(ret);
        }
Esempio n. 3
0
        //index = 0表示左脚   index = 1表示右脚
        public static bool FootLift(Vector3 firstVet, int index)
        {
            if (foots[index].Count < footsize)
            {
                return(false);
            }

            float firstFiveFrame = 0;
            float endFiveFrame   = 0;

            float[] footArray = foots[index].ToArray();

            for (int i = 0; i < footArray.Length; i++)
            {
                if (i < footsize / 2)
                {
                    endFiveFrame += footArray[i];
                }
                else
                {
                    firstFiveFrame += footArray[i];
                }
            }
            firstFiveFrame = firstFiveFrame * 2 / footsize;
            endFiveFrame   = endFiveFrame * 2 / footsize;

            float adjust = lengthShoulder / 8;

            if (ARGlobalDefs.IsIosPlatform())
            {
                adjust = lengthShoulder / 12;
            }
            ARDebug.Log("LiftUp adjust == " + adjust);
            ARDebug.Log("LiftUp endFiveFrame == " + endFiveFrame);
            ARDebug.Log("dowaLiftUpfff firstFiveFrame == " + firstFiveFrame);
            ARDebug.Log("dowaLiftDown ffffirstVet.y == " + firstVet.y);
            if ((endFiveFrame - firstFiveFrame) > adjust)
            {
                ARDebug.Log("dowaddLiftUpfff datas footLift Dwon i = " + index);
                return(true);
            }
            return(false);
        }
Esempio n. 4
0
 public static bool RightHandToExtern(Vector3 Wrist, Vector3 elbow, Vector3 shoulder)
 {
     if (Wrist.y < elbow.y && elbow.y < shoulder.y)
     {
         if (ARGlobalDefs.IsAndroidPlatform())
         {
             if (Wrist.x > elbow.x && elbow.x > shoulder.x)
             {
                 return(true);
             }
         }
         else
         {
             if (Wrist.x < elbow.x && elbow.x < shoulder.x)
             {
                 return(true);
             }
         }
     }
     return(false);
 }