예제 #1
0
        public FocusControllerStatus(XRHand hand) : base(hand)
        {
            if (WaveVR.Instance == null)
            {
                Debug.LogError("WaveVR.Instance is null!");
                return;
            }
            var wvr_hand = hand == XRHand.Left ? WVR_DeviceType.WVR_DeviceType_Controller_Left : WVR_DeviceType.WVR_DeviceType_Controller_Right;

            device     = WaveVR.Instance.getDeviceByType(wvr_hand);
            controller = WaveVR_Controller.Input(wvr_hand);
        }
예제 #2
0
    void Start()
    {
        c_dom         = WaveVR_Controller.Input(WaveVR_Controller.EDeviceType.Dominant);
        _prev         = false;
        dom_transform = transform.GetChild(3);

        labelStyle = new GUIStyle();
        labelStyle.normal.textColor = Color.black;

        linkStyle = new GUIStyle();
        linkStyle.normal.textColor = Color.blue;

        ml         = new Mesh();
        lmat       = new Material(shader);
        lmat.color = new Color(0, 0, 0, 0.3f);
    }
예제 #3
0
    void Start()
    {
        color = new Color(255, 0, 0);

        c_dom     = WaveVR_Controller.Input(WaveVR_Controller.EDeviceType.Dominant);
        c_non_dom = WaveVR_Controller.Input(WaveVR_Controller.EDeviceType.NonDominant);

        dom_t     = transform.GetChild(3);
        non_dom_t = transform.GetChild(4);

        width      = 0.005f;
        prev_press = false;
        num        = 0;

        drawingSphere.GetComponent <MeshRenderer>().enabled = true;
        eraser.GetComponent <MeshRenderer>().enabled        = false;

        moveInput();
        scaleInput();
    }
예제 #4
0
        private void UpdateDeviceInput(uint deviceIndex, WaveVR_Controller.Device deviceInput)
        {
#if VIU_WAVEVR_2_1_0_OR_NEWER
            const WVR_InputId digitalTrggerBumpID = WVR_InputId.WVR_InputId_Alias1_Digital_Trigger;
#else
            const WVR_InputId digitalTrggerBumpID = WVR_InputId.WVR_InputId_Alias1_Bumper;
#endif

            IVRModuleDeviceState   prevState;
            IVRModuleDeviceStateRW currState;

            if (!TryGetValidDeviceState(deviceIndex, out prevState, out currState) || !deviceInput.connected)
            {
                return;
            }

            if (deviceInput != null)
            {
                var systemPressed         = deviceInput.GetPress(WVR_InputId.WVR_InputId_Alias1_System);
                var menuPressed           = deviceInput.GetPress(WVR_InputId.WVR_InputId_Alias1_Menu);
                var triggerPressed        = deviceInput.GetPress(WVR_InputId.WVR_InputId_Alias1_Trigger);
                var digitalTriggerPressed = deviceInput.GetPress(digitalTrggerBumpID);
                var gripPressed           = deviceInput.GetPress(WVR_InputId.WVR_InputId_Alias1_Grip);
                var touchpadPressed       = deviceInput.GetPress(WVR_InputId.WVR_InputId_Alias1_Touchpad);
                var dpadLeftPressed       = deviceInput.GetPress(WVR_InputId.WVR_InputId_Alias1_DPad_Left);
                var dpadUpPressed         = deviceInput.GetPress(WVR_InputId.WVR_InputId_Alias1_DPad_Up);
                var dpadRightPressed      = deviceInput.GetPress(WVR_InputId.WVR_InputId_Alias1_DPad_Right);
                var dpadDownPressed       = deviceInput.GetPress(WVR_InputId.WVR_InputId_Alias1_DPad_Down);
                currState.SetButtonPress(VRModuleRawButton.System, systemPressed);
                currState.SetButtonPress(VRModuleRawButton.ApplicationMenu, menuPressed);
                currState.SetButtonPress(VRModuleRawButton.Touchpad, touchpadPressed || dpadLeftPressed || dpadUpPressed || dpadRightPressed || dpadDownPressed);
                currState.SetButtonPress(VRModuleRawButton.Trigger, triggerPressed || digitalTriggerPressed);
                currState.SetButtonPress(VRModuleRawButton.Grip, gripPressed);
                currState.SetButtonPress(VRModuleRawButton.DPadLeft, dpadLeftPressed);
                currState.SetButtonPress(VRModuleRawButton.DPadUp, dpadUpPressed);
                currState.SetButtonPress(VRModuleRawButton.DPadRight, dpadRightPressed);
                currState.SetButtonPress(VRModuleRawButton.DPadDown, dpadDownPressed);

                var systemTouched         = deviceInput.GetTouch(WVR_InputId.WVR_InputId_Alias1_System);
                var menuTouched           = deviceInput.GetTouch(WVR_InputId.WVR_InputId_Alias1_Menu);
                var triggerTouched        = deviceInput.GetTouch(WVR_InputId.WVR_InputId_Alias1_Trigger);
                var digitalTriggerTouched = deviceInput.GetTouch(digitalTrggerBumpID);
                var gripTouched           = deviceInput.GetTouch(WVR_InputId.WVR_InputId_Alias1_Grip);
                var touchpadTouched       = deviceInput.GetTouch(WVR_InputId.WVR_InputId_Alias1_Touchpad);
                var dpadLeftTouched       = deviceInput.GetTouch(WVR_InputId.WVR_InputId_Alias1_DPad_Left);
                var dpadUpTouched         = deviceInput.GetTouch(WVR_InputId.WVR_InputId_Alias1_DPad_Up);
                var dpadRightTouched      = deviceInput.GetTouch(WVR_InputId.WVR_InputId_Alias1_DPad_Right);
                var dpadDownTouched       = deviceInput.GetTouch(WVR_InputId.WVR_InputId_Alias1_DPad_Down);
                currState.SetButtonTouch(VRModuleRawButton.System, systemTouched);
                currState.SetButtonTouch(VRModuleRawButton.ApplicationMenu, menuTouched);
                currState.SetButtonTouch(VRModuleRawButton.Touchpad, touchpadTouched || dpadLeftTouched || dpadUpTouched || dpadRightTouched || dpadDownTouched);
                currState.SetButtonTouch(VRModuleRawButton.Trigger, triggerTouched || digitalTriggerTouched);
                currState.SetButtonTouch(VRModuleRawButton.Grip, gripTouched);
                currState.SetButtonTouch(VRModuleRawButton.DPadLeft, dpadLeftTouched);
                currState.SetButtonTouch(VRModuleRawButton.DPadUp, dpadUpTouched);
                currState.SetButtonTouch(VRModuleRawButton.DPadRight, dpadRightTouched);
                currState.SetButtonTouch(VRModuleRawButton.DPadDown, dpadDownTouched);

                var triggerAxis = deviceInput.GetAxis(WVR_InputId.WVR_InputId_Alias1_Trigger);
                var touchAxis   = deviceInput.GetAxis(WVR_InputId.WVR_InputId_Alias1_Touchpad);
                currState.SetAxisValue(VRModuleRawAxis.Trigger, triggerAxis.x);
                currState.SetAxisValue(VRModuleRawAxis.TouchpadX, touchAxis.x);
                currState.SetAxisValue(VRModuleRawAxis.TouchpadY, touchAxis.y);
            }
            else
            {
                currState.buttonPressed = 0u;
                currState.buttonTouched = 0u;
                currState.ResetAxisValues();
            }
        }