Exemplo n.º 1
0
 void Awake()
 {
     if (RotationMode == eRotationMode.QuickRotate || RotationMode == eRotationMode.SlowRotate)
     {
         Debug.Log("Quick Rotate || Slow Rotate Enabled TouchPad may override other buttons");
         RotateButton = SteamVRButtons.TouchPad;
     }
     if (RotationMode == eRotationMode.SlowRotate && fadeRotate == true)
     {
         Debug.Log("SlowRotate Does not work with Fade disabling");
         fadeRotate = false;
     }
     if (selectedController == null)
     {
         selectedController = trackedObj.transform;
     }
     Invoke("HideAllVisuals", .2f);
     if (fadeRotate || fadeTeleport)
     {
         if (!myFade)
         {
             Debug.Log("MyFade Not Assigned Disabling Fade toggles");
             fadeRotate   = false;
             fadeTeleport = false;
         }
     }
     MoveButtonH     = ReturnSteamVRButtons(MoveButton);
     RotateButtonH   = ReturnSteamVRButtons(RotateButton);
     TeleportButtonH = ReturnSteamVRButtons(TeleportButton);
     BlinkButtonH    = ReturnSteamVRButtons(BlinkButton);
 }
Exemplo n.º 2
0
 public InputAxis(Valve.VR.EVRButtonId id)
 {
     buttonID = id;
     pressed  = false;
     held     = false;
     released = false;
 }
Exemplo n.º 3
0
 public bool GetButtonUp(Valve.VR.EVRButtonId a_buttonMask)
 {
     if (m_deivce != null)
     {
         return(m_deivce.GetPressUp(a_buttonMask));
     }
     return(false);
 }
Exemplo n.º 4
0
    //private Collider col;
    //private SphereCollider sphereCollider;

    //Use this for initialization
    void Start()
    {
        triggerButton = Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger;
        trackedObject = GetComponent <SteamVR_TrackedObject>();

        //createSphereIsPossible = true;
        //createSphereIfPossible.createObjectIfPossible.createSphereIsPossible = true;
        //collision = false;
    }
Exemplo n.º 5
0
        private void HandleGrip()
        {
            Valve.VR.EVRButtonId      gripButton = Valve.VR.EVRButtonId.k_EButton_Grip;
            SteamVR_Controller.Device controller = SteamVR_Controller.Input((int)controllerIndex);

            if (controller.GetPress(gripButton))
            {
                Cancel();
            }
        }
Exemplo n.º 6
0
            /// <summary>
            /// Get the HTC Vive controller touch press up state.
            /// </summary>
            /// <returns><c>true</c>, if touch up was gotten, <c>false</c> otherwise.</returns>
            /// <param name="buttonID">Button identifier.</param>
            public bool GetTouchUp(Valve.VR.EVRButtonId buttonID)
            {
                if (VRReplay.Instance.Mode == VRReplay.ModeType.Playback)
                {
                    return(VRReplay.Instance.QueryVRInputBool(index, buttonID.ToString(), VRDeviceInputType.TouchUp));
                }
                bool state = device.GetTouchDown(buttonID);

                if (VRReplay.Instance.Mode == VRReplay.ModeType.Record)
                {
                    if (state)
                    {
                        VRReplay.Instance.RecordVRInputBool(index, buttonID.ToString(), VRDeviceInputType.TouchUp, state);
                    }
                }
                return(state);
            }
Exemplo n.º 7
0
            /// <summary>
            /// Get the HTC Vive controller axis touch value.
            /// </summary>
            /// <returns>The axis.</returns>
            /// <param name="buttonID">Button identifier.</param>
            public Vector2 GetAxis(Valve.VR.EVRButtonId buttonID = Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad)
            {
                if (VRReplay.Instance.Mode == VRReplay.ModeType.Playback)
                {
                    return(VRReplay.Instance.QueryVRInputVec2(index, buttonID.ToString(), VRDeviceInputType.AxisVec2));
                }
                Vector2 vec2 = device.GetAxis(buttonID);

                if (VRReplay.Instance.Mode == VRReplay.ModeType.Record)
                {
                    if (Mathf.Abs(vec2.x) > VRCommonUtils.EPSILON || Mathf.Abs(vec2.y) > VRCommonUtils.EPSILON)
                    {
                        VRReplay.Instance.RecordVRInputVec2(index, buttonID.ToString(), VRDeviceInputType.AxisVec2, vec2);
                    }
                }
                return(vec2);
            }
Exemplo n.º 8
0
    /// <summary>
    /// Calls the ray cast from the selector tool if it is active.
    /// </summary>
    void Update()
    {
        if (!m_Initialized)
        {
            return;
        }
        if (m_SelectorTool.gameObject.activeInHierarchy)
        {
            m_SelectorTool.GetRayFromController();
        }

        Valve.VR.EVRButtonId mask = Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad;
        VRUILogic.Instance.SetTouchPosition(0, m_SelectorTool.Controller.GetAxis(mask));
        VRUILogic.Instance.SetTouchedInfo(0, m_SelectorTool.Controller.GetTouch(mask));
        if (m_GUIController)
        {
            VRUILogic.Instance.SetTouchPosition(1, m_GUIController.Controller.GetAxis(mask));
            VRUILogic.Instance.SetTouchedInfo(1, m_GUIController.Controller.GetTouch(mask));
        }
    }
    public bool ButtonHeldDownBothController(Valve.VR.EVRButtonId button)
    {
        if (controllerInfos.Length == 0)
        {
            return(false);
        }
        for (int i = 0; i < controllerInfos.Length; i++)
        {
            if (GetController(i) == null)
            {
                return(false);
            }

            if (!GetController(i).GetPress(button))
            {
                return(false);
            }
        }
        return(true);
    }
Exemplo n.º 10
0
        public void ReceivedNewViveBindings(PStrafeButtonType touch, Valve.VR.EVRButtonId button, PStrafeHand hand)
        {
            if (Iface == null)
            {
                return;
            }

            try
            {
                var handNames = Enum.GetNames(typeof(PStrafeHand)).ToList();
                log.Info(touch);
                log.Info(hand);
                log.Info(button);

                Iface.ButtonType = touch;
                Iface.Hand       = hand;
                Iface.RunButton  = button;
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Exemplo n.º 11
0
 public DeviceButton(Valve.VR.EVRButtonId deviceButtonId)
 {
     _deviceButtonId = deviceButtonId;
 }
Exemplo n.º 12
0
    // the function used to get "Axis" information of buttoms

    /*
     * device: HTC Vive device, such as leftController/rightController
     * buttomID: the button ID, you can see [Valve.VR.EVRButtonId] for help
     */
    private Vector2 GetAxis(SteamVR_Controller.Device device, Valve.VR.EVRButtonId buttomId)
    {
        return(device.GetAxis(buttomId));
    }