Ejemplo n.º 1
0
        protected virtual void DetectController()
        {
            controllerType = VRTK_DeviceFinder.GetCurrentControllerType(controllerReference);
            if (controllerType != SDK_BaseController.ControllerType.Undefined)
            {
                if (setFingersForControllerType)
                {
                    switch (controllerType)
                    {
                    case SDK_BaseController.ControllerType.SteamVR_ViveWand:
                    case SDK_BaseController.ControllerType.SteamVR_WindowsMRController:
                    case SDK_BaseController.ControllerType.WindowsMR_MotionController:
                        thumbState       = VRTK_ControllerEvents.AxisType.Digital;
                        indexState       = VRTK_ControllerEvents.AxisType.Axis;
                        middleState      = VRTK_ControllerEvents.AxisType.Digital;
                        ringState        = VRTK_ControllerEvents.AxisType.Digital;
                        pinkyState       = VRTK_ControllerEvents.AxisType.Digital;
                        threeFingerState = VRTK_ControllerEvents.AxisType.Digital;
                        break;

                    case SDK_BaseController.ControllerType.Oculus_OculusTouch:
                    case SDK_BaseController.ControllerType.SteamVR_OculusTouch:
                        thumbState       = VRTK_ControllerEvents.AxisType.Digital;
                        indexState       = VRTK_ControllerEvents.AxisType.Axis;
                        middleState      = VRTK_ControllerEvents.AxisType.Digital;
                        ringState        = VRTK_ControllerEvents.AxisType.Digital;
                        pinkyState       = VRTK_ControllerEvents.AxisType.Digital;
                        threeFingerState = VRTK_ControllerEvents.AxisType.Axis;
                        break;

                    case SDK_BaseController.ControllerType.SteamVR_ValveKnuckles:
                        thumbState            = VRTK_ControllerEvents.AxisType.Digital;
                        indexState            = VRTK_ControllerEvents.AxisType.SenseAxis;
                        middleState           = VRTK_ControllerEvents.AxisType.SenseAxis;
                        ringState             = VRTK_ControllerEvents.AxisType.SenseAxis;
                        pinkyState            = VRTK_ControllerEvents.AxisType.SenseAxis;
                        threeFingerState      = VRTK_ControllerEvents.AxisType.SenseAxis;
                        threeFingerAxisButton = SDK_BaseController.ButtonTypes.StartMenu;
                        break;

                    default:
                        thumbState       = VRTK_ControllerEvents.AxisType.Digital;
                        indexState       = VRTK_ControllerEvents.AxisType.Digital;
                        middleState      = VRTK_ControllerEvents.AxisType.Digital;
                        ringState        = VRTK_ControllerEvents.AxisType.Digital;
                        pinkyState       = VRTK_ControllerEvents.AxisType.Digital;
                        threeFingerState = VRTK_ControllerEvents.AxisType.Digital;
                        break;
                    }
                }
                UnsubscribeEvents();
                SubscribeEvents();
                if (mirrorModel)
                {
                    mirrorModel = false;
                    MirrorHand();
                }
            }
        }
Ejemplo n.º 2
0
 protected virtual void OnDisable()
 {
     UnsubscribeEvents();
     controllerType = SDK_BaseController.ControllerType.Undefined;
     for (int i = 0; i < fingerAnimationRoutine.Length; i++)
     {
         fingerAnimationRoutine[i] = null;
     }
 }
 /// <summary>
 /// The SetStateByControllerReference method sets the object state based on the controller type of the given controller reference.
 /// </summary>
 /// <param name="controllerReference">A controller reference to check for the controller type of.</param>
 public virtual void SetStateByControllerReference(VRTK_ControllerReference controllerReference)
 {
     if (VRTK_ControllerReference.IsValid(controllerReference))
     {
         SDK_BaseController.ControllerType foundControllerType = VRTK_DeviceFinder.GetCurrentControllerType(controllerReference);
         if (foundControllerType != SDK_BaseController.ControllerType.Undefined && controllerType == foundControllerType)
         {
             ToggleObject();
         }
     }
 }
 protected virtual void ToggleOnController(VRTK_ControllerReference controllerReference)
 {
     if (controllerType != SDK_BaseController.ControllerType.Undefined)
     {
         SDK_BaseController.ControllerType foundControllerType = VRTK_DeviceFinder.GetCurrentControllerType(controllerReference);
         if (foundControllerType != SDK_BaseController.ControllerType.Undefined && controllerType == foundControllerType)
         {
             ToggleObject();
         }
     }
 }
Ejemplo n.º 5
0
        // Token: 0x06001BCA RID: 7114 RVA: 0x00091418 File Offset: 0x0008F618
        protected virtual VRTK_SDKTransformModifiers GetSelectedModifier()
        {
            VRTK_SDKTransformModifiers vrtk_SDKTransformModifiers = this.sdkOverrides.FirstOrDefault((VRTK_SDKTransformModifiers item) => item.loadedSDKSetup == this.sdkManager.loadedSetup);

            if (vrtk_SDKTransformModifiers == null)
            {
                SDK_BaseController.ControllerType currentController = VRTK_DeviceFinder.GetCurrentControllerType();
                vrtk_SDKTransformModifiers = this.sdkOverrides.FirstOrDefault((VRTK_SDKTransformModifiers item) => item.controllerType == currentController);
            }
            return(vrtk_SDKTransformModifiers);
        }
Ejemplo n.º 6
0
        protected virtual VRTK_SDKTransformModifiers GetSelectedModifier(VRTK_ControllerReference controllerReference)
        {
            //attempt to find by the overall SDK set up to start with
            VRTK_SDKTransformModifiers selectedModifier = sdkOverrides.FirstOrDefault(item => item.loadedSDKSetup == VRTK_SDKManager.GetLoadedSDKSetup());

            //If no sdk set up is found or it is null then try and find by the SDK controller
            if (selectedModifier == null)
            {
                SDK_BaseController.ControllerType currentControllerType = VRTK_DeviceFinder.GetCurrentControllerType(controllerReference);
                selectedModifier = sdkOverrides.FirstOrDefault(item => item.controllerType == currentControllerType);
            }
            return(selectedModifier);
        }
        protected virtual VRTK_SDKVector2AxisInputOverrideType GetSelectedModifier(List <VRTK_SDKVector2AxisInputOverrideType> overrideTypes, VRTK_ControllerReference controllerReference)
        {
            //attempt to find by the overall SDK set up to start with
            VRTK_SDKVector2AxisInputOverrideType selectedModifier = overrideTypes.FirstOrDefault(item => item.loadedSDKSetup == sdkManager.loadedSetup);

            //If no sdk set up is found or it is null then try and find by the SDK controller
            if (selectedModifier == null)
            {
                SDK_BaseController.ControllerType currentControllerType = VRTK_DeviceFinder.GetCurrentControllerType(controllerReference);
                selectedModifier = overrideTypes.FirstOrDefault(item => item.controllerType == currentControllerType);
            }
            return(selectedModifier);
        }
Ejemplo n.º 8
0
        protected virtual void DetectController()
        {
            controllerType = VRTK_DeviceFinder.GetCurrentControllerType();
            if (controllerType != SDK_BaseController.ControllerType.Undefined)
            {
                if (setFingersForControllerType)
                {
                    switch (controllerType)
                    {
                    case SDK_BaseController.ControllerType.SteamVR_ViveWand:
                        thumbState       = VRTK_ControllerEvents.AxisType.Digital;
                        indexState       = VRTK_ControllerEvents.AxisType.Axis;
                        middleState      = VRTK_ControllerEvents.AxisType.Digital;
                        ringState        = VRTK_ControllerEvents.AxisType.Digital;
                        pinkyState       = VRTK_ControllerEvents.AxisType.Digital;
                        threeFingerState = VRTK_ControllerEvents.AxisType.Digital;
                        break;

                    case SDK_BaseController.ControllerType.Oculus_OculusTouch:
                    case SDK_BaseController.ControllerType.SteamVR_OculusTouch:
                        thumbState       = VRTK_ControllerEvents.AxisType.Digital;
                        indexState       = VRTK_ControllerEvents.AxisType.Axis;
                        middleState      = VRTK_ControllerEvents.AxisType.Axis;
                        ringState        = VRTK_ControllerEvents.AxisType.Axis;
                        pinkyState       = VRTK_ControllerEvents.AxisType.Axis;
                        threeFingerState = VRTK_ControllerEvents.AxisType.Axis;
                        break;

                    default:
                        thumbState       = VRTK_ControllerEvents.AxisType.Digital;
                        indexState       = VRTK_ControllerEvents.AxisType.Digital;
                        middleState      = VRTK_ControllerEvents.AxisType.Digital;
                        ringState        = VRTK_ControllerEvents.AxisType.Digital;
                        pinkyState       = VRTK_ControllerEvents.AxisType.Digital;
                        threeFingerState = VRTK_ControllerEvents.AxisType.Digital;
                        break;
                    }
                }
                UnsubscribeEvents();
                SubscribeEvents();
                if (mirrorModel)
                {
                    mirrorModel = false;
                    MirrorHand();
                }
            }
        }
Ejemplo n.º 9
0
 protected virtual void SetControllerType()
 {
     controllerType = (controllerReference != null ? VRTK_DeviceFinder.GetCurrentControllerType(controllerReference) : SDK_BaseController.ControllerType.Undefined);
 }