public bool IsGrabbingWithType(IEntity handEntity, IF_VR_GrabType type)
        {
            var steamVRHand = handEntity.GetUnityComponent <IF_VR_Steam_Hand>();

            if (steamVRHand.noSteamVRFallbackCamera)
            {
                if (Input.GetMouseButton(0))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            if (type == IF_VR_Steam_GrabTypes.Grip.ConvertTo())
            {
                return(vrGloveInterface.GetGrabState(steamVRHand.handType.ConvertTo()));
            }
            //else
            //if (type == IF_VR_Steam_GrabTypes.Pinch.ConvertTo())
            //{
            //    return vrGloveInterface.GetGrabState(hand.Type);
            //}
            return(false);
        }
Exemplo n.º 2
0
        public bool IsGrabbingWithType(IEntity handEntity, IF_VR_GrabType type)
        {
            var steamVRHand = handEntity.GetUnityComponent <IF_VR_Steam_Hand>();

            if (steamVRHand.noSteamVRFallbackCamera)
            {
                if (Input.GetMouseButton(0))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            if (type == IF_VR_Steam_GrabTypes.Grip.ConvertTo())
            {
                return(steamVRHand.grabGripAction.GetState(steamVRHand.handType));
            }
            else if (type == IF_VR_Steam_GrabTypes.Pinch.ConvertTo())
            {
                return(steamVRHand.grabPinchAction.GetState(steamVRHand.handType));
            }

            return(false);
        }
Exemplo n.º 3
0
        public IF_VR_GrabType GetGrabEnding(IEntity handEntity, IF_VR_GrabType explicitType = IF_VR_GrabType.None)
        {
            var steamVRHand = handEntity.GetUnityComponent <IF_VR_Steam_Hand>();

            if (explicitType != IF_VR_Steam_GrabTypes.None.ConvertTo())
            {
                if (steamVRHand.noSteamVRFallbackCamera)
                {
                    if (Input.GetMouseButtonUp(0))
                    {
                        return(explicitType);
                    }
                    else
                    {
                        return(IF_VR_Steam_GrabTypes.None.ConvertTo());
                    }
                }

                if (explicitType == IF_VR_Steam_GrabTypes.Pinch.ConvertTo() && steamVRHand.grabPinchAction.GetStateUp(steamVRHand.handType))
                {
                    return(IF_VR_Steam_GrabTypes.Pinch.ConvertTo());
                }
                if (explicitType == IF_VR_Steam_GrabTypes.Grip.ConvertTo() && steamVRHand.grabGripAction.GetStateUp(steamVRHand.handType))
                {
                    return(IF_VR_Steam_GrabTypes.Grip.ConvertTo());
                }
            }
            else
            {
                if (steamVRHand.noSteamVRFallbackCamera)
                {
                    if (Input.GetMouseButtonUp(0))
                    {
                        return(IF_VR_Steam_GrabTypes.Grip.ConvertTo());
                    }
                    else
                    {
                        return(IF_VR_Steam_GrabTypes.None.ConvertTo());
                    }
                }

                if (steamVRHand.grabPinchAction.GetStateUp(steamVRHand.handType))
                {
                    return(IF_VR_Steam_GrabTypes.Pinch.ConvertTo());
                }
                if (steamVRHand.grabGripAction.GetStateUp(steamVRHand.handType))
                {
                    return(IF_VR_Steam_GrabTypes.Grip.ConvertTo());
                }
            }
            return(IF_VR_Steam_GrabTypes.None.ConvertTo());
        }
        public IF_VR_GrabType GetGrabStarting(IEntity handEntity, IF_VR_GrabType explicitType = IF_VR_GrabType.None)
        {
            var steamVRHand = handEntity.GetUnityComponent <IF_VR_Steam_Hand>();

            if (explicitType != IF_VR_Steam_GrabTypes.None.ConvertTo())
            {
                if (steamVRHand.noSteamVRFallbackCamera)
                {
                    if (Input.GetMouseButtonDown(0))
                    {
                        return(explicitType);
                    }
                    else
                    {
                        return(IF_VR_Steam_GrabTypes.None.ConvertTo());
                    }
                }

                // pinch not supoorted
                //if (explicitType == IF_VR_Steam_GrabTypes.Pinch.ConvertTo() && vrGloveInterface.GetGrabStateDown(hand.Type))
                //    return IF_VR_Steam_GrabTypes.Pinch.ConvertTo();
                if (explicitType == IF_VR_Steam_GrabTypes.Grip.ConvertTo() && vrGloveInterface.GetGrabStateDown(steamVRHand.handType.ConvertTo()))
                {
                    return(IF_VR_Steam_GrabTypes.Grip.ConvertTo());
                }
            }
            else
            {
                if (steamVRHand.noSteamVRFallbackCamera)
                {
                    if (Input.GetMouseButtonDown(0))
                    {
                        return(IF_VR_Steam_GrabTypes.Grip.ConvertTo());
                    }
                    else
                    {
                        return(IF_VR_Steam_GrabTypes.None.ConvertTo());
                    }
                }


                //if (vrGloveInterface.GetGrabStateDown(hand.Type))
                //    return IF_VR_Steam_GrabTypes.Pinch.ConvertTo();
                if (vrGloveInterface.GetGrabStateDown(steamVRHand.handType.ConvertTo()))
                {
                    return(IF_VR_Steam_GrabTypes.Grip.ConvertTo());
                }
            }
            return(IF_VR_Steam_GrabTypes.None.ConvertTo());
        }
Exemplo n.º 5
0
        public IF_VR_GrabType GetBestGrabbingType(IEntity handEntity, IF_VR_GrabType preferred, bool forcePreference = false)
        {
            var steamVRHand = handEntity.GetUnityComponent <IF_VR_Steam_Hand>();

            if (steamVRHand.noSteamVRFallbackCamera)
            {
                if (Input.GetMouseButton(0))
                {
                    return(preferred);
                }
                else
                {
                    return(IF_VR_Steam_GrabTypes.None.ConvertTo());
                }
            }

            if (preferred == IF_VR_Steam_GrabTypes.Pinch.ConvertTo())
            {
                if (steamVRHand.grabPinchAction.GetState(steamVRHand.handType))
                {
                    return(IF_VR_Steam_GrabTypes.Pinch.ConvertTo());
                }
                else if (forcePreference)
                {
                    return(IF_VR_Steam_GrabTypes.None.ConvertTo());
                }
            }
            if (preferred == IF_VR_Steam_GrabTypes.Grip.ConvertTo())
            {
                if (steamVRHand.grabGripAction.GetState(steamVRHand.handType))
                {
                    return(IF_VR_Steam_GrabTypes.Grip.ConvertTo());
                }
                else if (forcePreference)
                {
                    return(IF_VR_Steam_GrabTypes.None.ConvertTo());
                }
            }

            if (steamVRHand.grabPinchAction.GetState(steamVRHand.handType))
            {
                return(IF_VR_Steam_GrabTypes.Pinch.ConvertTo());
            }
            if (steamVRHand.grabGripAction.GetState(steamVRHand.handType))
            {
                return(IF_VR_Steam_GrabTypes.Grip.ConvertTo());
            }
            return(IF_VR_Steam_GrabTypes.None.ConvertTo());
        }
 public static IF_VR_Steam_GrabTypes ConvertTo(this IF_VR_GrabType type)
 {
     if (type == IF_VR_GrabType.Grip)
     {
         return(IF_VR_Steam_GrabTypes.Grip);
     }
     else if (type == IF_VR_GrabType.Pinch)
     {
         return(IF_VR_Steam_GrabTypes.Pinch);
     }
     else if (type == IF_VR_GrabType.Scripted)
     {
         return(IF_VR_Steam_GrabTypes.Scripted);
     }
     return(IF_VR_Steam_GrabTypes.None);
 }
        public IF_VR_GrabType GetBestGrabbingType(IEntity handEntity, IF_VR_GrabType preferred, bool forcePreference = false)
        {
            var steamVRHand = handEntity.GetUnityComponent <IF_VR_Steam_Hand>();

            if (steamVRHand.noSteamVRFallbackCamera)
            {
                if (Input.GetMouseButton(0))
                {
                    return(preferred);
                }
                else
                {
                    return(IF_VR_Steam_GrabTypes.None.ConvertTo());
                }
            }

            //if (preferred == IF_VR_Steam_GrabTypes.Pinch.ConvertTo())
            //{
            //    if (vrGloveInterface.GetGrabState(hand.Type))
            //        return IF_VR_Steam_GrabTypes.Pinch.ConvertTo();
            //    else if (forcePreference)
            //        return IF_VR_Steam_GrabTypes.None.ConvertTo();
            //}
            if (preferred == IF_VR_Steam_GrabTypes.Grip.ConvertTo())
            {
                if (vrGloveInterface.GetGrabState(steamVRHand.handType.ConvertTo()))
                {
                    return(IF_VR_Steam_GrabTypes.Grip.ConvertTo());
                }
                else if (forcePreference)
                {
                    return(IF_VR_Steam_GrabTypes.None.ConvertTo());
                }
            }

            //if (vrGloveInterface.GetGrabState(hand.Type))
            //    return IF_VR_Steam_GrabTypes.Pinch.ConvertTo();
            if (vrGloveInterface.GetGrabState(steamVRHand.handType.ConvertTo()))
            {
                return(IF_VR_Steam_GrabTypes.Grip.ConvertTo());
            }
            return(IF_VR_Steam_GrabTypes.None.ConvertTo());
        }