ValveSoftware / steamvr_unity_plugin

SteamVR Unity Plugin - Documentation at: https://valvesoftware.github.io/steamvr_unity_plugin/
BSD 3-Clause "New" or "Revised" License
1.03k stars 256 forks source link

Assign Role to Vive Tracker #526

Open jeffcrouse opened 5 years ago

jeffcrouse commented 5 years ago

I apologize if this isn't the right place for this -- there are so many parties involved in this issue, I'm not sure where to go.

My issue is that I would like to use SteamVR_Behaviour_Pose with an assigned "Input Source" with my Vive Trackers, just like it is used with Controllers. It seems that the recommended way to use the trackers is to assign it a "Role" (ie: Left Foot) using the "Manage Vive Trackers" tool and then use a SteamVR_Behaviour_Pose and set the Input Source to "Right Foot". But this doesn't work.

I can get trackers working with SteamVR_TrackedObject, but this is a terrible workflow because every time I restart Steam the device has a different device ID. I know I can iterate through all of the attached devices and get their serial numbers and match those up with the desired TrackedObject. But this is only marginally better because it involves either hard-coding in device serial numbers or creating an interface from scratch to type them in.

Furthermore, when I look at my System Report, the HMD and the controllers all have logical "Best Alias" values, such as /user/hand/right, /user/head, etc. I imagine that this is how it gets recognized in the Behavior_Pose. But with the Trackers, even after assigning them a Role via the Manage Vive Trackers window, all of the trackers have the same value for "Best Alias" that they do for "Device Path", which has nothing to do with the Role it is assigned.

Any tips would be greatly appreciated!

JashanChittesh commented 5 years ago

I'm currently struggling with the same issue: I've had a complete working system based on SteamVR Unity Plugin 1.2.3 that used heuristics to determine the roles of each tracker based on the distance to the Avatar joint. With SteamVR Input 2.0, it has been a bit of a rough ride.

But the good news: Most likely, the only thing that's missing for you is the proper binding for the tracker. At least that was the issue for me when I started switching to "how things are done the new way".

So, you already have a game object with SteamVR_Behaviour_Pose, and the input source assigned to let's say Left Foot. You also have a tracker assigned to Left Foot via Manage Vive Trackers. What you (probably) still need to do is:

Select Vive Tracker on Left Foot as Current Controller in the Binding UI (on the first screen, upper right). It will probably show nothing under Current Binding, so you need to "Create New Binding". In there, you either have to Add Action Pose or Edit Action Poses. There, assign Pose to user/foot/left/pose/raw.

In my case, assigning Pose didn't work at first. That almost drove me crazy. Most likely, the reason this didn't work was that I had InteractUI set as Mandatory (because I thought it was, um, mandatory and didn't think of the fact that SteamVR Input 2.0 then forces players to assign that action in every binding, even if it does not make any sense at all, e.g. for Vive Trackers that don't even have a trigger button). After setting this to Suggested and reloading everything, assigning the Pose worked.

Using the Bindings UI to create those files is a bit of a nightmare; plus it will add a lot of clutter to those files that is just confusing and not necessary. I'm currently copy'n'pasting and hand-editing these files and can probably put them here once this is all done.

JashanChittesh commented 5 years ago

So here are my Vive Tracker bindings for

You'll probably want to change the name in those files (this has our games' names included).

ViveTrackerBindings.zip

crzhunter commented 4 years ago

I'm currently struggling with the same issue: I've had a complete working system based on SteamVR Unity Plugin 1.2.3 that used heuristics to determine the roles of each tracker based on the distance to the Avatar joint. With SteamVR Input 2.0, it has been a bit of a rough ride.

But the good news: Most likely, the only thing that's missing for you is the proper binding for the tracker. At least that was the issue for me when I started switching to "how things are done the new way".

So, you already have a game object with SteamVR_Behaviour_Pose, and the input source assigned to let's say Left Foot. You also have a tracker assigned to Left Foot via Manage Vive Trackers. What you (probably) still need to do is:

Select Vive Tracker on Left Foot as Current Controller in the Binding UI (on the first screen, upper right). It will probably show nothing under Current Binding, so you need to "Create New Binding". In there, you either have to Add Action Pose or Edit Action Poses. There, assign Pose to user/foot/left/pose/raw.

In my case, assigning Pose didn't work at first. That almost drove me crazy. Most likely, the reason this didn't work was that I had InteractUI set as Mandatory (because I thought it was, um, mandatory and didn't think of the fact that SteamVR Input 2.0 then forces players to assign that action in every binding, even if it does not make any sense at all, e.g. for Vive Trackers that don't even have a trigger button). After setting this to Suggested and reloading everything, assigning the Pose worked.

Using the Bindings UI to create those files is a bit of a nightmare; plus it will add a lot of clutter to those files that is just confusing and not necessary. I'm currently copy'n'pasting and hand-editing these files and can probably put them here once this is all done.

Thank you very much!!! It is crazy ,that set vive tracker bind part then you have to set it again in Binding UI... fxxk!!

PTrottier commented 4 years ago

Thanks @JashanChittesh for the bindings, really helpful. Made a Unity package based on your bindings in this repository: https://github.com/PTrottier/SteamVR_Trackers_Unity