Jump to content
 
arjun

How to get input from tracker when the controllers are connected

Recommended Posts

@chengnay

Thanks for the reply. I tried the suggestion you mentioned earlier with the binding in Unity 2019.2. It keeps throwing the error complaining the input doesn't exist. Am I doing anything wrong? Do I need to move those bindings to certain location to make it work?

On 6/24/2019 at 11:21 PM, chengnay said:

1. Replace all files in zip file(PartialInputBindings.zip) attached to the Assets\HTC.UnityPlugin\ViveInputUtility\Scripts\Misc\SteamVRExtension\PartialInputBindings

2. Remove json files in your project root path

  - actions.json, bindings_*.json

3. Remove Assets\SteamVR_Input folder

4. Go to Edit>Preferences>VIU Settings, uncheck and check the VIVE option to allow "View Recommended Settings" to appear.

5. Click on View Recommended Settings and click Use recommended to Apply VIU Action Set

 

BTW, do we still need to go through SteamVR binding system to set up all the things like we do regularly? I tried to get button input from pucks as tracker (not controller). 

 

Thanks a lot!

Share this post


Link to post
Share on other sites

@Pandiabolism When you clone a latest VIU from GitHub, you will need to apply VIU Action Set for SteamVR Input.

image.png.a0ed5e6856c3a56fa6f470271004da27.png

 

If you do not see above button in Recommended Settings, please go to your project root folder,

Remove all json files (actions.json and bindings_*.json), then unchecked and checked VIVE from VIU Settings.

 

Share this post


Link to post
Share on other sites

@chengnay Thank you so much for the reply. I have tested it in Teleport Scene of VIU example in Unity 2019.2. 

However, trackers'  button can only be detected when there's no controllers connected.

Once with controllers connected, the trackers either take over the role as controller or would not be able to be fire button press (trigger, menu, etc via pogo)---at least the button press couldn't be detected in VIU.

Did I miss anything for setup?

Share this post


Link to post
Share on other sites

@chengnay  Originally I set it to be "left foot“ and all sorts, it works only when controllers are not connected. But what I was trying to do is to just use DeviceID to get button input from tracker with two controllers connected. (kinda bypassing SteamVR role binding)

Share this post


Link to post
Share on other sites

@Pandiabolism If you update your SteamVR Plugin to 2.0 and above, I don't think using the DeviceID to get the button input will still work.

What is your SteamVR Plugin and VIU version?

Share this post


Link to post
Share on other sites

I have quite a similar problem and despite all my efforts i could'nt fix it.

I can only get input from two devices at the same time.

It depends of the order i connect them.

If i connect my two controllers, then my two trackers. Then I will only get trigger input from the controllers.

If i turn the controllers off, then i will be able to get the trigger input from the trackers using the Pogo Pins (by connecting the pin 2 and 4 with a wire)

My problem seems a bit different than the one you got @chengnay because it doesn't seem to be a unity problem : i can reproduce it using the input debuger tool of steam VR. (see attached screenshot) 

I tried your fix Chengnay, but it didnt work. I also found this method on this post :https://www.reddit.com/r/beatsaber/comments/bn6e4u/ragesaqs_school_of_making_a_vive_tracker_maul/ involving changing the tracker json configuration file but it didn't work either.

Here are the versions i use

Unity version : 2019.3.7.f1

VIU plugin : could reproduce the problem on v1.0.6, v1.0.7 and v1.0.11 (downloaded directly on Github page)

SteamVR Plugin : 2.5.0 (sdk 1.8.19)

SteamVR Utility : 1.12.5

If needed i can send the Unity Project.
Help would be really appreciated as this limitation is a blocker for our project.

Thank you

bug.jpg

Share this post


Link to post
Share on other sites

I did some further investigation with 6 trackers at the same time.

Here are the results :

The tests are with the two controllers turned off.

  • Test1 Connect all the trackers at the same time, launch my Unity App : No input at all is detetected (reproduced 3 times)
  • Test 2 : turn off all the tracker, turn on tracker n°1 : Trigger is detected on tracker 1 : OK
  • Test 2 : turn on tracker n°2 ; Trigger is detected on tracker 1 & tracker 2 : OK
  • Test 3 Turn on tracker n°3 ; Trigger is only detected on Tracker 1 & 2 not the n°3 : NOK
  • Test 4 : Turn on tracker n°4 : trigger is only detected on Tracker 1 and tracker 3 !!!??!! : NOK
  • Test 5 : Turn on tracker n°5 trigger is only detected on Tracker 1 and tracker 4 !!!??!! : NOK
  • Test 6 : Turn on tracker n°6 trigger is only detected on Tracker 1 and tracker 5 !!!??!! : NOK

So thats very strange behaviour.... and i could reproduce it with different tracker orders.

I have only 2 trackers at the same time that can trigger input with pogo pins 

Sometimes they don't work at all( when i start all the trackers simultaneously before playing the Unity App)

 

Some more precisions : i used the VIU RoleBindingExample scene to assign tracker numbers from one to 6.

The 6 trackers are correctly positionned in the scene.

I use the following code  to detect trigger press

bool triggerPressed = ViveInput.GetPress(m_ViveRole, ControllerButton.Trigger);

as it does not always work, i also use 

bool menuPressed = ViveInput.GetPress(m_ViveRole, ControllerButton.Menu); 

which works in all scenarios when there are only 2 trackers at the same time.

The m_ViveRole variable is assigned in the inspector :

public ViveRoleProperty m_ViveRole;

overall the code looks like this

public class TrackerFollow : MonoBehaviour
{

    public ViveRoleProperty m_ViveRole;


    private void Update()
    {
        gameObject.transform.position = VivePose.GetPose(m_ViveRole).pos;
        gameObject.transform.rotation = VivePose.GetPose(m_ViveRole).rot;

        bool menuPressed = ViveInput.GetPress(m_ViveRole, ControllerButton.Menu);
        if (menuPressed)
        {
            Debug.Log("MenuPressed");
        }

        bool triggerPressed = ViveInput.GetPress(m_ViveRole, ControllerButton.Trigger);
        
        float scale = 0.2f;
        if (triggerPressed || menuPressed)
        {
            Debug.Log("Scale!" + name);
            scale = 0.4f;
        }
        gameObject.transform.localScale = Vector3.one * scale;
    }

}

This script is attached to cubes in the scene, each cube has its ViveRole property set to its corresponding tracker id. See screenshot in attachement.

05.jpg

Share this post


Link to post
Share on other sites

Please sign in to comment

You need to be a member in order to leave a comment

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...