コード例 #1
0
        private void RotationGestureTrackingUpdate()
        {
            List <Quaternion> rotationHistory = GetRotationHistory();

            if (rotationHistory == null || rotationHistory.Count <= 0)
            {
                return;
            }

            float rotAceleration = Quaternion.Angle(rotationHistory[0], rotationHistory[rotationHistory.Count - 1]);

            //detect a fast rotation movement
            if (rotAceleration > maxAcelerationThreshold)
            {
                rotationGesturePhase = GesturePhase.Processing;
            }
        }
コード例 #2
0
        private void RotationGestureProcessingUpdate()
        {
            List <Quaternion> rotationHistory = GetRotationHistory();

            if (rotationHistory == null || rotationHistory.Count <= 0)
            {
                return;
            }

            float rotAceleration = Quaternion.Angle(rotationHistory[0], rotationHistory[rotationHistory.Count - 1]);

            //wait for the hand to stop
            if (rotAceleration < minAcelerationThreshold)
            {
                OnRotationGestureEvent.Invoke(new RotationGestureInfo(rotationGesturefromQuaternion, rotationHistory[rotationHistory.Count - 1]));
                rotationGesturePhase = GesturePhase.Tracking;
            }
        }