Пример #1
0
 public MyHands GetHand(OVRHand.Hand type)
 {
     if (type == OVRHand.Hand.HandLeft)
     {
         return(m_hands[0]);
     }
     else
     {
         return(m_hands[1]);
     }
 }
    /// <summary>
    /// Utility to get the OVRHand for a given hand (left or right)
    /// </summary>
    private OVRHand GetOVRHand(OVRHand.Hand handType)
    {
        foreach (var hand in GetComponentsInChildren <OVRHand>())
        {
            if (hand.HandType == handType)
            {
                return(hand);
            }
        }

        Debug.LogError("[PinchManager] Could not get OVRHand with hand type '" + handType + "'.");
        return(null);
    }
Пример #3
0
    private void SetHandGesture(OVRHand.Hand hand, string gesture)
    {
        HandGesture handGesture = HandGesture.None;

        switch (gesture)
        {
        case "thumb":
        case "Thumb":
            handGesture = HandGesture.Thumb;
            break;

        case "ok":
        case "Ok":
            handGesture = HandGesture.Ok;
            break;

        case "flat":
        case "Flat":
            handGesture = HandGesture.Flat;
            break;

        case "fist":
        case "Fist":
            handGesture = HandGesture.Fist;
            break;

        case "menu":
        case "Menu":
            handGesture = HandGesture.Menu;
            break;

        case "handonarm":
        case "HandOnArm":
            handGesture = HandGesture.HandOnArm;
            break;
        }

        if (hand == OVRHand.Hand.HandLeft)
        {
            _leftHandGesture = handGesture;
        }
        else if (hand == OVRHand.Hand.HandRight)
        {
            _rightHandGesture = handGesture;
        }
        //ComputeFinalGesture();
    }
Пример #4
0
        private void ResolveHandType()
        {
            _hand = GetComponent <OVRHand>();

            FieldInfo info = _hand.GetType().GetField("HandType", BindingFlags.NonPublic | BindingFlags.Instance);

            if (info is null)
            {
                return;
            }

            OVRHand.Hand handType = (OVRHand.Hand)info.GetValue(_hand);

            switch (handType)
            {
            case OVRHand.Hand.HandLeft:
                _handType = HandType.Left;
                break;

            case OVRHand.Hand.HandRight:
                _handType = HandType.Right;
                break;
            }
        }