/// <summary>
        /// returns the orientation of the hand
        /// </summary>
        /// <param name="isLeftHand"></param>
        /// <returns></returns>
        public Quaternion getHandOrientation(bool isLeftHand)
        {
            if (!HandData.IsHandDataInitialized()) _hd = HandData.Instance;

            hand_rotation_ = Quaternion.Slerp (hand_rotation_, _hd.getHandOrientation (isLeftHand), (1.0f - rotationFiltering));

            return hand_rotation_;
        }
        /// <summary>
        /// constructor of the interface
        /// </summary>
        public SmoothedHandDataInterface()
        {
            _hd = HandData.Instance;
            hand_rotation_ = Quaternion.identity;
            current_event = HandEventType.None;

            handEventStorage = new HandEventType[storageSize];

            for (int i = 0; i < storageSize; i++) {
                handEventStorage[i] = HandEventType.None;
            }
        }
        /// <summary>
        /// returns the state of the hand
        /// </summary>
        /// <param name="isLeftHand"></param>
        /// <returns></returns>
        public HandEventType getHandEvent(bool isLeftHand)
        {
            if (!HandData.IsHandDataInitialized()) _hd = HandData.Instance;

            HandEventType new_event = _hd.getHandEvent (isLeftHand);
            int current_event_counter = 0;

            handEventStorage [storageIterator % storageSize] = new_event;

            for (int i = 0; i < storageSize; i++) {
                if(handEventStorage[i] == new_event) current_event_counter++;
            }

            if (current_event_counter == storageSize) {
                current_event = new_event;
            }

            storageIterator++;
            return current_event;
        }
 /// <summary>
 /// returns the position of the hand
 /// </summary>
 /// <param name="isLeftHand"></param>
 /// <returns></returns>
 public Vector3 getHandPosition(bool isLeftHand)
 {
     if (!HandData.IsHandDataInitialized()) _hd = HandData.Instance;
     return _hd.getHandPosition(isLeftHand);
 }
 /// <summary>
 /// returns the orientation of the hand
 /// </summary>
 /// <param name="isLeftHand"></param>
 /// <returns></returns>
 public Quaternion getHandOrientation(bool isLeftHand)
 {
     if (!HandData.IsHandDataInitialized()) _hd = HandData.Instance;
     return _hd.getHandOrientation(isLeftHand);
 }
 /// <summary>
 /// returns the state of the hand
 /// </summary>
 /// <param name="isLeftHand"></param>
 /// <returns></returns>
 public HandEventType getHandEvent(bool isLeftHand)
 {
     if (!HandData.IsHandDataInitialized()) _hd = HandData.Instance;
     return _hd.getHandEvent(isLeftHand);
 }
 /// <summary>
 /// constructor
 /// </summary>
 public UnalteredHandDataInterface()
 {
     _hd = HandData.Instance;
 }
Ejemplo n.º 8
0
        /// <summary>
        /// initialization
        /// </summary>
        void Start()
        {
            // set the singleton instance
            instance = this;

            _km = KinectManager.Instance;
            primaryUserID = 0;

            //left init
            leftHandPos = Vector3.zero;
            leftHandOri = Quaternion.identity;
            lastLeftHandEvent = HandEventType.Release;
            leftHandEvent = HandEventType.None;
            leftHandState = KinectInterop.HandState.Unknown;

            //right init
            rightHandPos = Vector3.zero;
            rightHandOri = Quaternion.identity;
            lastRightHandEvent = HandEventType.Release;
            rightHandEvent = HandEventType.None;
            rightHandState = KinectInterop.HandState.Unknown;
        }