Ejemplo n.º 1
0
        private void OnPoseSync(object sender, PoseFrameMMapSyncer.OnSyncEventArgs e)
        {
            Vector2 temp;

            // Track the left wrist
            if (CurrentSwipeCooldown >= SwipeCooldown)
            {
                // don't track points on cooldown
                if (e.SyncData.GetConfidence(EJointName.LEFT_WRIST) > ConfidenceThreshold)
                {
                    temp = e.SyncData.GetWorldPosition(EJointName.LEFT_WRIST);
                    PrevLeftHandPositions.AddLast(new Vector3(temp.x, temp.y, Time.time));
                }
                if (e.SyncData.GetConfidence(EJointName.RIGHT_WRIST) > ConfidenceThreshold)
                {
                    temp = e.SyncData.GetWorldPosition(EJointName.RIGHT_WRIST);
                    PrevRightHandPositions.AddLast(new Vector3(temp.x, temp.y, Time.time));
                }
            }

            while (PrevLeftHandPositions.Count > 0 && Mathf.Abs(Time.time - PrevLeftHandPositions.First.Value.z) > RealTimePerSwipe)
            {
                // We do an abs in case there's overflow. Time otherwise doesn't flow backwards so
                // this is fine
                PrevLeftHandPositions.RemoveFirst();
            }

            while (PrevRightHandPositions.Count > 0 && Mathf.Abs(Time.time - PrevRightHandPositions.First.Value.z) > RealTimePerSwipe)
            {
                // We do an abs in case there's overflow. Time otherwise doesn't flow backwards so
                // this is fine
                PrevRightHandPositions.RemoveFirst();
            }

            TryRecognize();
        }
Ejemplo n.º 2
0
 private void Pose_OnSync(object sender, PoseFrameMMapSyncer.OnSyncEventArgs e)
 {
 }