Not much need to be said about the new input system steam has implemented. People hate it, I like it, people hate me. I hope I’m kidding about that, we’ll see when this article goes live. But the reason I like it is probably that I understand it, and from what I can tell that is a rare thing. Thus this article. I really hope you like it and find it useful, If you have any questions post them in the comments section. Now that we have all that out of the way let’s get started.
Why Use Actions?
As you probably know, the new SteamVR input system is based on actions. Now, instead of directly accessing the inputs through code we have to assign variables to input sources through a custom
How Does It Work?
All right, now for the grand tour. Open a unity project with the SteamVR plugin and go to the windows menu, you should see a button to open the SteamVR Input menu that looks just like
You are going to use the first Input panel the most but you ming also notice the button to open the SteamVR Input Live View, This is just a handy tool that shows you the current state of all your actions while in play mode. Go ahead And open the first input panel, It should look a little something like this:
So let’s analyze this menu from the top down. For
Making An Action Input
To make an action just click the plus button at the bottom of the action list and you should get one like this:
Going once more from top to bottom we first see a field to enter a name. Once again I have to stress, make it intelligent sounding, people see it.
Boolean’s are mostly used for buttons. On second thought, there only use i as a button.
Vector1, Basically a float. You can use it to get analog input from triggers and the like.
Vector2’s are used to get input from touchpads and thumbsticks.
vector3’s are a mystery, since the next type is used for positions. I guess Valve just wanted to cover all their bases.
poses are what are used now to get the position of the controllers and headset, under the logic that some people might want to change the point their controllers are tracked from.
skeleton’s are not yet implemented to Windows Mixed Reality Headsets so my knowledge about them is limited. Nevertheless, they are used to approximate the position of a users hand and display a corresponding model.
Next we have the Required bullet point list, this is used to tell your players the priority of a particular input. Just not that the binding UI will not let you save until all actions marked required are parred. The last two fields are outside the scope of this tutorial.
Using The UI
Now click the Open Binding UI button and you should get a screen like this:
This is where you select your controller and what bindings to change. You can select your controller by clicking the name of the current one and then selecting the correct one from the popup. To edit, click edit and the binding screen will open:
As always, we start at the top and work our way down. At the top of the page, we see four tabs, these match up with the action sets we see in the Input window. the idea is that you have different action sets for different situations. But it’s perfectly fine to only use the default one for now. On the left, we have a scrollable menu that allows us to assign actions to our controls. This is where most of the work is done, and where some of the confusion. comes in. It isn’t quite as simple as assigning an action to the trigger. First what you do is click the plus box next to the name of the control you want to use. This will bring up a menu asking what you want to use the control as. There are too many different examples to explain them all so it’s important to explore them yourself. Once you choose one, let’s say you are using the trigger as a button, you now see a new section on the left sidebar.
Now we can finally assign our actions. In the “use as” section that we just created you can see different events that trigger the actions assigned to them. To assign an action, just click the none box right next to the event you want to trigger your action and you will get a menu that shows you all the compatible actions you can assign to that particular event.
You may also notice that there is an identical menu to the right of the screen that is greyed out, this is because the action set is currently mirrored. You could change this in the Input window or with the checkbox in the middle of the screen but It’s a lot faster to just use mirrored action sets.
In the middle of the screen you see three buttons: add chords, edit action poses, and edit haptics. Chords are too complicated for this tutorial but action poses are really important. They are how unity gets the position and rotation of the controllers. As long as you don’t mess with the default bindings you shouldn’t have to worry about it. And Haptics is how you bind Haptic outputs to your controllers.
And finally, we have the five buttons at the bottom of the screen. The first, publish to
Using Action Input In Code
I feel that this 600-word long monolog is a little too long so I’m going to refer you to my VR hand tutorial, It has instructions on how to use input and some code you can copy directly into your project. I hope you found something useful in this article, If you didn’t, post a comment and I’ll try to fix it. I hope to see you around.
Hello, I am busy trying to figure out your last post about walking in VR,I followed the steps you gave and also read the comments.It sure did help a lot, if I when I hit play , what should i use to move?
I tried holding the touchpad and by even double tapping , but there were still no movement.
I tried out this post and still could not fix this problem.
Without more information on your problem, I can’t be much help. When you touch the touchpad anywhere but the center you should move. Check to make sure you steamVR actions are set and make sure speed is not set to 0, It’s gotten me before. Also If you set the deadline to more then .9 you might have problems.