コード例 #1
0
    /// <summary>
    /// Returns the axis of a given Oculus axis button/joystick.
    /// </summary>
    public Vector3 CheckOculus2DAxisState(OVRInput.Axis2D axis)
    {
        if (!ovrUpdateCalledThisFrame)
        {
            OVRInput.Update();
            ovrUpdateCalledThisFrame = true;
        }

        return(OVRInput.Get(axis, GetOculusController()));
    }
コード例 #2
0
 void CheckAnalog2DAndOutputText(OVRInput.Axis2D data)
 {
     if (OVRInput.Get(data) != Vector2.zero)
     {
         tm3.text += "<color=#ff0000>";
     }
     else
     {
         tm3.text += "<color=#ffffff>";
     }
     tm3.text += data.ToString() + ":" + OVRInput.Get(data).ToString() + "\n";
     tm3.text += "</color>";
 }
コード例 #3
0
    // Token: 0x06005667 RID: 22119 RVA: 0x001DBBD0 File Offset: 0x001D9FD0
    private Vector2 GetAxis2D(OVRInput.Axis2D axis, OVRInput.Controller controller)
    {
        EVRButtonId buttonId;

        if (axis != OVRInput.Axis2D.PrimaryThumbstick)
        {
            buttonId = EVRButtonId.k_EButton_Max;
        }
        else
        {
            buttonId = EVRButtonId.k_EButton_Axis0;
        }
        return(this.GetSteamController(controller).GetAxis(buttonId));
    }
コード例 #4
0
ファイル: OculusInputAxis.cs プロジェクト: nuttylord/projects
 /// <summary>
 ///   <para>Toggles the Oculus Axis defined by the <strong>axisMask</strong> parameter so as to associate the Input Axis with an Oculus Touch Input Axis.</para>
 ///   <innovasys:widget type="Caution Box" layout="block" xmlns:innovasys="http://www.innovasys.com/widgets">
 ///     <innovasys:widgetproperty layout="block" name="Content">
 ///       <strong>Be careful!</strong> Oculus devices do not use virtual inputs or virtual mappings managed
 ///     through the <see cref="!:https://docs.unity3d.com/Manual/class-InputManager.html">Unity Input Manager</see>. Instead, they are accessed
 ///     directly through the <see cref="!:https://developer.oculus.com/downloads/game-engines/1.5.0/Oculus_Utilities_for_Unity_5/">Oculus
 ///     Utilities for Unity</see>.</innovasys:widgetproperty>
 ///   </innovasys:widget>
 /// </summary>
 /// <param name="axisMask">An <see cref="OVRInput.Axis1D" /> enum value which represents a bitmask corresponding to one of the hard-coded 1-dimensional input axes supported by Oculus devices.</param>
 public void toggleAxis1D(OVRInput.Axis1D axisMask)
 {
     if (axisMask != OVRInput.Axis1D.None)
     {
         _previousAxis1D = this.axis1D;
         _previousAxis2D = this.axis2D;
         _axis2D         = OVRInput.Axis2D.None;
         _axis1D         = axisMask;
     }
     else
     {
         _previousAxis1D = this.axis1D;
         _axis1D         = OVRInput.Axis1D.None;
         _axis2D         = _previousAxis2D;
     }
 }
コード例 #5
0
ファイル: Sword.cs プロジェクト: petrosKon/Stabbing_Post_its
    private void PickAndRotateSword(Hand pickedBy, OVRInput.Axis2D thumbstick)
    {
        if (!firstPicked)
        {
            firstPicked = true;
            onSwordFirstPickUp();
        }

        grabbedBy = pickedBy;
        if (OVRInput.Get(thumbstick).x > 0.5f)
        {
            postItsParent.transform.Rotate(Vector3.up, rotationAmount * Time.deltaTime);
        }
        else if (OVRInput.Get(thumbstick).x < -0.5f)
        {
            postItsParent.transform.Rotate(Vector3.up, -rotationAmount * Time.deltaTime);
        }
    }
コード例 #6
0
 // Get - Axis
 public static Vector2 Get(OVRInput.Axis2D input)
 {
     if (Input.GetKey(KeyCode.W))
     {
         return(new Vector2(0, +1));
     }
     if (Input.GetKey(KeyCode.S))
     {
         return(new Vector2(0, -1));
     }
     if (Input.GetKey(KeyCode.D))
     {
         return(new Vector2(+1, 0));
     }
     if (Input.GetKey(KeyCode.A))
     {
         return(new Vector2(-1, 0));
     }
     return(OVRInput.Get(input));
 }
コード例 #7
0
    private bool GetOVRButtonDown(SVControllerType controller, SVInputButton button)
    {
        bool isRight = (controller == SVControllerType.SVController_Right);

        OVRInput.Controller ovrController = (isRight ? OVRInput.Controller.RTouch : OVRInput.Controller.LTouch);

        switch (button)
        {
        // Buttons
        case SVInputButton.SVButton_A:
        case SVInputButton.SVButton_B:
        case SVInputButton.SVButton_System:
        case SVInputButton.SVButton_Thumbstick_Press:
            return(OVRInput.Get(GetOVRButtonMapping(button), ovrController));

        // 2D Axis
        case SVInputButton.SVButton_Thumbstick_Down:
        case SVInputButton.SVButton_Thumbstick_Left:
        case SVInputButton.SVButton_Thumbstick_Right:
        case SVInputButton.SVButton_Thumbstick_Up:
        {
            OVRInput.Axis2D axis2D = OVRInput.Axis2D.PrimaryThumbstick;

            Vector2 vec = OVRInput.Get(axis2D, ovrController);

            if (button == SVInputButton.SVButton_Thumbstick_Down)
            {
                return(vec.y < -0.75);
            }
            else if (button == SVInputButton.SVButton_Thumbstick_Up)
            {
                return(vec.y > 0.75);
            }
            else if (button == SVInputButton.SVButton_Thumbstick_Left)
            {
                return(vec.x < -0.75);
            }
            else if (button == SVInputButton.SVButton_Thumbstick_Right)
            {
                return(vec.x > 0.75);
            }
            return(false);
        }

        // 1D Axis
        case SVInputButton.SVButton_Trigger:
        case SVInputButton.SVButton_Grip:
        {
            OVRInput.Axis1D axis = OVRInput.Axis1D.PrimaryIndexTrigger;
            if (button == SVInputButton.SVButton_Trigger)
            {
                axis = OVRInput.Axis1D.PrimaryIndexTrigger;
            }
            else if (button == SVInputButton.SVButton_Grip)
            {
                axis = OVRInput.Axis1D.PrimaryHandTrigger;
            }
            return(OVRInput.Get(axis, ovrController) > 0.75f);
        }

        default:
            return(false);
        }
    }
コード例 #8
0
 public Vector2 GetAxis2D(OVRInput.Axis2D axis)
 {
     return(OVRInput.Get(axis, controller));
 }
コード例 #9
0
 public virtual void OnStickAnalogValue(OVRInput.Axis2D type, Vector2 axis)
 {
 }
コード例 #10
0
 private Vector2 OnAxis(OVRInput.Axis2D axis, OVRInput.Controller controller)
 {
     return(OVRInput.Get(axis, controller));
 }
コード例 #11
0
 public static Vector2 Get(OVRInput.Axis2D virtualMask, OVRInput.Controller controllerMask = OVRInput.Controller.Active)
 {
     return(InputDevice.TouchPos);
 }