SteamVR Developer Hardware

SteamVR Developer Hardware

dimmu1313 Dec 25, 2016 @ 11:19am
Unity and Xbox Gamepad in VR
I have an Oculus Rift with Touch Controllers and of course the xbox controller that comes with the OR. I've been searching high and low to figure out how to *not* have steam VR use the touch controllers but use the xbox controller instead. I'm not interested in making a game with the touch controllers at this point, but all tutorials and other sources say to drop the "tracked controller" script on left and right controller objects, but all that seems to do is get button recognition on the touch controllers. The head tracking works fine, but all I want to do is simply move the camera (I think) with a gamepad but the steam vr scene/assets I downloaded from the asset store doesn't even mention using a gamepad. I would have thought that would be the *default* setup since not everyone has the touch controllers. I'm just getting started in 3d development, though I've done plenty of c# scripting and 2d UI type of stuff. It seemed like since so much works with steam vr out of the box in unity that it shouldn't be this difficult to move around in the game space with the xbox controller. help!
< >
Showing 1-9 of 9 comments
Bangerman Dec 25, 2016 @ 11:35am 
Unity uses the xbox controllers already, its independent of steamvr
dimmu1313 Dec 25, 2016 @ 1:24pm 
Originally posted by Bangerman:
Unity uses the xbox controllers already, its independent of steamvr

I thought that might be the case, but in the Steam VR tutorials I've seen, when I go in to test the environment, the xbox controller does nothing to move me (the camera) around, even though out of the box moving my head around does move the camera, at least where I'm looking. In other words I want to be able to look around AND move fwd/back/left/right. The Steam VR "camera rig" object I'm told to drop in has a left and right controller, and I have to drop a "tracked controller" script onto each of those, but all that does is add recognition of the touch controllers.

Assuming there's nothing special about the camera in the Steam VR camera rig object, how do I move the camera (player) when I move the joystick(s) on the xbox controller?
Bangerman Dec 25, 2016 @ 2:05pm 
Unfiortunatly this is the point where you have to learn how to write code in order to make a game!
dimmu1313 Dec 25, 2016 @ 2:13pm 
Originally posted by Bangerman:
Unfiortunatly this is the point where you have to learn how to write code in order to make a game!

I understand that there's scripting involved. I've been doing lots of that with UI work. But given that there is nothing intuitive about Unity whatsoever, it is simply not obvious in any way how make the game camera move with an xbox controller, let alone do so in the Steam VR setup. I've searched quite a bit and, as I said, I can only find examples of using the touch controllers. And even in those examples the touch controllers aren't used to translate camera position.
GMM Dec 25, 2016 @ 2:52pm 
Originally posted by dimmu1313:
Originally posted by Bangerman:
Unfiortunatly this is the point where you have to learn how to write code in order to make a game!

I understand that there's scripting involved. I've been doing lots of that with UI work. But given that there is nothing intuitive about Unity whatsoever, it is simply not obvious in any way how make the game camera move with an xbox controller, let alone do so in the Steam VR setup. I've searched quite a bit and, as I said, I can only find examples of using the touch controllers. And even in those examples the touch controllers aren't used to translate camera position.

To be fair, while i think Unity's controller input system is rather bad, it's very easy to find examples of how to integrate simple controller support into your project and it has nothing directly to do with SteamVR.

I suggest looking at this page for a reference on the button keys:
http://wiki.unity3d.com/index.php?title=Xbox360Controller

For the best standard controller input control, i would recommend buying ReWired on the Asset store:
https://www.assetstore.unity3d.com/en/#!/content/21676

In order to move a SteamVR player, you will need to parent the player camera to some kind of pivot object, usually i would structure it like this:

Player--->Camera Pivot--->Player Camera

Keep in mind you should always move a player relative to the facing direction of the camera, so you will need to calculate the movement from the direction of the camera and apply the movement to the camera pivot object.

Keep in mind when rotating the pivot, the SteamVR camera will also be rotated with the offset from the Pivot center, so you will need to rotate the pivot object around the camera.
Last edited by GMM; Dec 25, 2016 @ 2:54pm
dimmu1313 Dec 25, 2016 @ 3:52pm 
Originally posted by GMM:
Originally posted by dimmu1313:
In order to move a SteamVR player, you will need to parent the player camera to some kind of pivot object, usually i would structure it like this:

Player--->Camera Pivot--->Player Camera

All I have right now is the Steam VR out-of-the-box "camera rig". Is that the same as the player? Since it's VR and I automatically assume I should be looking at all things first-person perspective, isn't all of what you said simply the Steam VR Camera Rig? Shouldn't I only need to move the whole Camera Rig object with the xbox controller? So I guess I'm confused as to why you say the controller input has nothing to do with SteamVR. I mean, I understand the asset bundle isn't providing me with controller drivers or anything, but whatever I do with the controller it seems like I should need to somehow tie it to the SteamVR asset(s).

Also, on the button keys reference you linked, none of the names of buttons or axes match with anything listed in the Input Manager. The former shows "X Axis", "Y Axis", and some numbers; the Input Manager shows "horizontal", "vertical", "Mouse X", "Mouse Y" etc. Am I supposed to delete all the entries in Input Manager and add all the ones listed in the button mapping?
GMM Dec 25, 2016 @ 4:14pm 
Controller input has nothing to do with the libraries SteamVR provides, what we are talking about is manipulating GameObjects within your Unity Scene, the methods utilized isnt exclusive for usage with SteamVR only, therefore it has nothing to do with SteamVR in itself, we however will need to couple it to the 3D positioned camera within your scene.

The SteamVR rig has a usable hiarchy for manipulating the origin position and orientation of the camera within the scene, you would however have to manipulate "[CameraRig]". In order for the camera to move forward, you can just manipulate the position without any major issues, but rotating the camera will make your end users very sick if you just rotate the SteamVR rig itself, since the actual camera will not locally be positioned in (0,0,0), so you will need to rotate the rig around the "Camera (Head)" object.

You are supposed to at least add the Axis of the sticks to the input manager(i believe Horizontal and Vertical already corresponds to one of the sticks), the button states can be gotten using the Unity Input class from code.

It is important to note that you absolutely do not need all the stuff in the rig, a standard Unity camera will get the head tracking applied as long as the project supports OpenVR.
Last edited by GMM; Dec 25, 2016 @ 4:17pm
dimmu1313 Dec 25, 2016 @ 4:16pm 
Originally posted by GMM:
Controller input has nothing to do with the libraries SteamVR provides, what we are talking about is manipulating GameObjects within your Unity Scene, the methods utilized isnt exclusive for usage with SteamVR only, therefore it has nothing to do with SteamVR in itself, we however will need to couple it to the 3D positioned camera within your scene.

The SteamVR rig has a usable hiarchy for manipulating the origin position and orientation of the camera within the scene, you would however have to manipulate "[CameraRig]". In order for the camera to move forward, you can just manipulate the position without any major issues, but rotating the camera will make your end users very sick if you just rotate the SteamVR rig itself, since the actual camera will not locally be positioned in (0,0,0), so you will need to rotate the rig around the "Camera (Head)" object.

You are supposed to at least add the Axis of the sticks to the input manager, the button states can be gotten using the Unity Input class from code.

I appreciate the help.
GMM Dec 25, 2016 @ 4:31pm 
Originally posted by dimmu1313:
Originally posted by GMM:
Controller input has nothing to do with the libraries SteamVR provides, what we are talking about is manipulating GameObjects within your Unity Scene, the methods utilized isnt exclusive for usage with SteamVR only, therefore it has nothing to do with SteamVR in itself, we however will need to couple it to the 3D positioned camera within your scene.

The SteamVR rig has a usable hiarchy for manipulating the origin position and orientation of the camera within the scene, you would however have to manipulate "[CameraRig]". In order for the camera to move forward, you can just manipulate the position without any major issues, but rotating the camera will make your end users very sick if you just rotate the SteamVR rig itself, since the actual camera will not locally be positioned in (0,0,0), so you will need to rotate the rig around the "Camera (Head)" object.

You are supposed to at least add the Axis of the sticks to the input manager, the button states can be gotten using the Unity Input class from code.

I appreciate the help.
:2016watermelon:
< >
Showing 1-9 of 9 comments
Per page: 1530 50

Date Posted: Dec 25, 2016 @ 11:19am
Posts: 9