Beispiel #1
0
        void RecognizeNod()
        {
            try
            {
                var averagePitch = PoseSamplesWithin(0.2f, 0.4f).Average(sample => sample.eulerAngles.x);
                var maxPitch     = PoseSamplesWithin(0.01f, 0.2f).Max(sample => sample.eulerAngles.x);
                var pitch        = PoseSamples.First().eulerAngles.x;

                if (maxPitch - averagePitch > maxNodValue &&
                    Mathf.Abs(pitch - averagePitch) < nodValue)
                {
                    if (prevGestureTime < Time.time - recognitionInterval)
                    {
                        prevGestureTime = Time.time;
                        NodHandler?.Invoke();
                    }
                }
            }
            catch (InvalidOperationException)
            {
                // PoseSamplesWithin contains no entry
            }
        }
Beispiel #2
0
        void RecognizeNod()
        {
            try
            {
                float basePos = Range(0.2f, 0.4f).Average(sample => sample.eulerAngles.x);
                float xMax    = Range(0.01f, 0.2f).Max(sample => sample.eulerAngles.x);
                float current = samples.First().eulerAngles.x;

                if (xMax - basePos > 10f &&
                    Mathf.Abs(current - basePos) < 5f)
                {
                    if (NodHandler != null)
                    {
                        NodHandler.Invoke();
                    }
                    waitTime = recognitionInterval;
                }
            }
            catch (InvalidOperationException)
            {
                // Range contains no entry
            }
        }