示例#1
0
        public bool GetGrabStateUp(IF_VR_HandType handType)
        {
            var handData = HandDataManager.GetHandData(handType == IF_VR_HandType.Left ? ManusVR.SDK.Apollo.device_type_t.GLOVE_LEFT : ManusVR.SDK.Apollo.device_type_t.GLOVE_RIGHT);

            if (handData == null)
            {
                return(false);
            }

            return(handData.GetGrabStateUp());
        }
 public IEntity GetHandEntity(IF_VR_HandType type)
 {
     if (type == IF_VR_HandType.Left)
     {
         return(IF_VR_Steam_Player.instance.leftHand.gameObject.GetEntity());
     }
     else if (type == IF_VR_HandType.Right)
     {
         return(IF_VR_Steam_Player.instance.rightHand.gameObject.GetEntity());
     }
     return(null);
 }
 public static SteamVR_Input_Sources ConvertTo(this IF_VR_HandType type)
 {
     if (type == IF_VR_HandType.Left)
     {
         return(SteamVR_Input_Sources.LeftHand);
     }
     else if (type == IF_VR_HandType.Right)
     {
         return(SteamVR_Input_Sources.RightHand);
     }
     return(SteamVR_Input_Sources.Any);
 }
示例#4
0
        public void SetInputSource(GameObject sourceGo, SteamVR_Input_Sources handType)
        {
            IF_VR_HandType type = IF_VR_HandType.Any;

            if (handType == SteamVR_Input_Sources.LeftHand)
            {
                type = IF_VR_HandType.Left;
            }
            else if (handType == SteamVR_Input_Sources.RightHand)
            {
                type = IF_VR_HandType.Right;
            }

            eventSystem.Publish(new IF_VR_Event_SetInputSource()
            {
                SourceEntity = sourceGo.GetEntity(),
                HandType     = type
            });
        }
        void createGloveEntity(Transform parent, IF_VR_HandType handType)
        {
            string gloveName    = "IF_VR_Glove" + handType.ToString();
            var    gloveGo      = new GameObject(gloveName);
            var    gloveWristGo = new GameObject(gloveName + "Wrist");

            gameObjectTool.SetParentWithInit(gloveGo, parent);
            gameObjectTool.SetParentWithInit(gloveWristGo, gloveGo.transform);

            var pool        = entityDatabase.GetCollection();
            var gloveEntity = pool.CreateEntity();

            gloveGo.LinkEntity(gloveEntity, pool);
            gloveEntity.AddComponent(new IF_VR_Glove_Hand()
            {
                Type  = handType,
                Wrist = gloveWristGo.transform
            });
        }
        public IEntity GetHandTrackerEntity(IF_VR_HandType type)
        {
            IF_VR_Steam_Hand hand = null;

            if (type == IF_VR_HandType.Left)
            {
                hand = IF_VR_Steam_Player.instance.leftHand;
            }
            else if (type == IF_VR_HandType.Right)
            {
                hand = IF_VR_Steam_Player.instance.rightHand;
            }

            if (hand == null)
            {
                return(null);
            }

            return(hand.trackedObject.gameObject.GetEntity());
        }