Search Unity

How to get thumbpad axis values from new openVR steam controller stuff?

Discussion in 'VR' started by alchemycreative, Dec 3, 2018.

  1. alchemycreative

    alchemycreative

    Joined:
    Nov 12, 2018
    Posts:
    3
    Hello!
    I can't find an example anywhere of anyone using the new OpenVR controller input stuff for the Vive thumb pad touch position...
    Anybody have an example...
    I'm getting touchpad press thus:
    if (rightTouch.GetStateDown(inputSource))
    where rightTouch is a boolean Teleport action... but how to get axis position?
    I guess i need to set up a Joystick input or something in the Steam VR Input window...
    I feel like some basic tutorials/docs on this stuff is missing? Or I'm just missing it...
    Thanks.
     
  2. itoumpalidis

    itoumpalidis

    Joined:
    Aug 23, 2018
    Posts:
    1
    You need to set up an action through the steamVR Input Window (Window>SteamVR Input ).
    Create a new action and make it type of Vector2. In the binding UI you can attach the action in the touchpad.
    To read user's input you can do:

    Code (CSharp):
    1. using Valve.VR;
    2.  
    3.  
    4. SteamVR_Input.{nameOfYourBinding}.inActions.{yourActionName}.GetAxis(SteamVR_Input_Sources.Any);

    In the getAxis you can specify the hand you attached your function in the binding UI, left,right or Any.


    The logic have changed, and it is a bit confusing in the beginning. Read this tutorial here
    https://steamcommunity.com/sharedfiles/filedetails/?id=1416820276

    and also check the Interactions_Example scene (SteamVR>InteractionSystem>Samples) you can find an example that uses controller's touchpad to move a doll around.
     
    alchemycreative likes this.
  3. alchemycreative

    alchemycreative

    Joined:
    Nov 12, 2018
    Posts:
    3
    Ahh.... amazing thanks that's so helpful!
    In the end to get at the axis value in the script I just made this public var
    public SteamVR_Action_Vector2 touchPad;
    and then assigned it to the new action i made in the steamVR Input Window.
    and then in the script touchPad.GetAxis(...); gives me what i need...
    Awesome.
    Thanks.