コード例 #1
0
    public void configureVRControlability()
    {
        bool enableVRcontrol = XRDevice.isPresent;

        // configure whether elements shall be clicked by vr controlers or mouse
        hudvr.SetActive(enableVRcontrol);
        hudmouse.SetActive(!enableVRcontrol);
        gameMenuvr.SetActive(enableVRcontrol);
        gameMenumouse.SetActive(!enableVRcontrol);
        modVoteMenuvr.SetActive(enableVRcontrol);
        modVoteMenumouse.SetActive(!enableVRcontrol);
        voteMenuvr.SetActive(enableVRcontrol);
        voteMenumouse.SetActive(!enableVRcontrol);

        StandaloneInputModule mouseInput = (StandaloneInputModule)eventSystem.GetComponent("StandaloneInputModule");

        if (null != mouseInput)
        {
            mouseInput.enabled = !enableVRcontrol;
        }
        ControllerSelection.OVRInputModule vrInput = (ControllerSelection.OVRInputModule)eventSystem.GetComponent("OVRInputModule");
        if (null != vrInput)
        {
            vrInput.enabled = enableVRcontrol;
        }
    }
コード例 #2
0
ファイル: UI_Handler.cs プロジェクト: yazici/siar-breach
 private void Init_UI_system()
 {
     //Enable Eventsystem VR input, disable PC input
     pcInput         = MyEventSystem.GetComponent <StandaloneInputModule>();
     vrInput         = MyEventSystem.GetComponent <ControllerSelection.OVRInputModule>();
     pcInput.enabled = false;
     vrInput.enabled = true;
     MyEventSystem.GetComponent <EventSystem>().UpdateModules();
 }
コード例 #3
0
 public void OnPointerEnter(UnityEngine.EventSystems.PointerEventData e)
 {
     UnityEngine.EventSystems.PointerEventData ped = e as OVRRayPointerEventData;
     if (ped != null)
     {
         // Gaze has entered this canvas. We'll make it the active one so that canvas-mouse pointer can be used.
         OVRInputModule inputModule = UnityEngine.EventSystems.EventSystem.current.currentInputModule as OVRInputModule;
         inputModule.activeGraphicRaycaster = this;
     }
 }
コード例 #4
0
 void Awake()
 {
     if (trackingSpace == null)
     {
         Debug.LogWarning("OVRPointerVisualizer did not have a tracking space set. Looking for one");
         trackingSpace = OVRInputHelpers.FindTrackingSpace();
     }
     if (gazePointer != null)
     {
         // gazePointerにコライダが付いていると動作に支障をきたすのでオフっておく。
         var collider = gazePointer.GetComponent <Collider>();
         if (collider != null)
         {
             collider.enabled = false;
         }
     }
     if (inputModule == null)
     {
         inputModule = EventSystem.current.currentInputModule as OVRInputModule;
     }
 }
コード例 #5
0
        /// <summary>
        /// Is this the currently focussed Raycaster according to the InputModule
        /// </summary>
        /// <returns></returns>
        public bool IsFocussed()
        {
            OVRInputModule inputModule = UnityEngine.EventSystems.EventSystem.current.currentInputModule as OVRInputModule;

            return(inputModule && inputModule.activeGraphicRaycaster == this);
        }