Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get binding as a friendly user string #1017

Open
AndersMalmgren opened this issue Oct 28, 2018 · 33 comments
Open

Get binding as a friendly user string #1017

AndersMalmgren opened this issue Oct 28, 2018 · 33 comments

Comments

@AndersMalmgren
Copy link

AndersMalmgren commented Oct 28, 2018

I'm looking into making our tutorial work with the new API, after looking into ValveSoftware/steamvr_unity_plugin#167 i fixed so the GetDeviceComponentName method returned what it should. I guess scroll_wheel is just a bug and it Should return touchpad.

Lets say action Release magazine is bound to D Pad North. Then a text saying Touchpad wont do. Maybe you guys can add a method, GetUserFriendlyDescription which will return something like 'D Pad North' but maybe thats not enough, maybe it even needs to return "Touch D Pad North" or "Click D Pad North",

edit: This is a fork from ValveSoftware/steamvr_unity_plugin#165

@AndersMalmgren
Copy link
Author

Here is an old prototype video of our Tutorial that shows how it works today

https://www.youtube.com/watch?v=aBjM7HGmEU8

@zite
Copy link
Contributor

zite commented Nov 6, 2018

Unfortunately this is a bug we haven't been able to fix yet. I'll let you know when we get this fixed.

@AndersMalmgren
Copy link
Author

@zite Thanks for feedback, cant wait to test this feature either in our tutorial :D

@zite
Copy link
Contributor

zite commented Jan 2, 2019

I believe we have a function that will better suit your needs in the most recent beta. All in actions now have public string GetLocalizedOriginPart(params EVRInputStringBits[] localizedParts). It takes as many parts of the string as you want to get out, see the summary of the method for more info. This is in the 2.2b3 beta: https://github.com/ValveSoftware/steamvr_unity_plugin/releases/tag/2.2b3

@AndersMalmgren
Copy link
Author

I will have a look at get back to you, thanks

@AndersMalmgren
Copy link
Author

@zite Ok I tested both GetLocalizedOrigin and GetLocalizedOriginPart they give same error

image

@zite
Copy link
Contributor

zite commented Jan 3, 2019

Looks like there's a bug with OpenVR where if the action hasn't been used yet it throws errors. Should still have a more friendly error message. Probably something better for inactive actions as well.

@AndersMalmgren
Copy link
Author

AndersMalmgren commented Jan 3, 2019

@zite Thanks, that was the issue. I think it might be a bit restrictive to require the ActionSet and Action to be activated for it to work. I dont think it will be a problem for my in game tutorial because its flow driven, when you complete one task in the tutorial you will move to the next so the actionsets will always be enabled. But I could see a problem for someone that want to display the controls on a help me screen. There could be actionsets not enabled at that time. Sure you could enable all disabled sets, generate the help page than disable them again. Though, not a very ncie workflow.

Again, not a problem for me currently. What is a problem though is that a action bound to Trackpad North only returns "Trackpad". That wont help a player to understand how he should activate the action sadly.

@AndersMalmgren
Copy link
Author

So I saw that you are moving for release (RC2 is out) How about this feature?

@zite
Copy link
Contributor

zite commented Jan 23, 2019

Unfortunately this is an underlying SteamVR issue which has releases separately from the unity plugin.

@AndersMalmgren
Copy link
Author

Do you have any ETA when it will be fixed? We offcourse want to go live before Knuckles are released to the public

@AndersMalmgren
Copy link
Author

AndersMalmgren commented Jan 29, 2019

I have implemented GetLocalizedOriginPart in the actual tutorial now

It works very well for interaction actions that use the trigger etc,
image

But as we discussed earlier its really counterintuitive when using the Trackpad as a D-Pad
image

Hope you guys are looking to fix it.

I also found a bug. If I use SteamVR_Input_Sources.Any and one of the hands actions are disabled I get same error as before

image

Here is a workaround for that

        private static readonly SteamVR_Input_Sources[] handSources = new [] { SteamVR_Input_Sources.LeftHand, SteamVR_Input_Sources.RightHand };

        protected string GetActionCaption(SteamVR_Action_Boolean action)
        {
            foreach (var source in handSources)
                if(action.GetActive(source)) //Workaround for bug in steamVR
                    return string.Format("<b>{0}</b>", action.GetLocalizedOriginPart(source, EVRInputStringBits.VRInputString_InputSource).ToLower());

            return "<Unbound>";
        }

And it works

@AndersMalmgren
Copy link
Author

btw @zite Its really not optimal that the actionset/action needs to be enabled for it to work. Its really fragile and creates timing issues easily.

@AndersMalmgren
Copy link
Author

AndersMalmgren commented Jan 29, 2019

@zite hi again. Actually, its not a timing issue at all. I did some logging

image

I grab the item and then upgrade its prio to 2
and then I read the caption using GetLocalizedOriginPart. This could be related to #1020 similar behaviour . Anyway, I active and try to read the caption in same frame, could be that too. I think you need todo a full regression test on the activate action set / prio stuff.

@kisak-valve kisak-valve transferred this issue from ValveSoftware/steamvr_unity_plugin Jan 30, 2019
@AndersMalmgren
Copy link
Author

A quick note for the guys at openvr that starts to look at this. There are now two issues here. First, the GetLocalizedOriginPart returns "Trackpad" even if the action is bound to "Trackpad North".

Second issue is that the action needs to be active for the GetLocalizedOriginPart to work, to me thats a bit counterintuitive, you might want to display all bindings in a help screen without any action sets being active for example. In my case I can live with it becasuse my tutorial is in-game and flow driven so the actions will be active when I call GetLocalizedOriginPart. The problem is there is a bug in openvr/unity-plugin so if I active the actionset and call GetLocalizedOriginPart in same frame it does not work.

@AndersMalmgren
Copy link
Author

Hey guys any thoughts on this? While not a complete show stopper it's really not snappy for Vive wands players when they play the game the first time and any action bound to Track pad just says Trackpad instead of D Pad North or similar. Thanks

@AndersMalmgren
Copy link
Author

So I saw that you got the new bindings UI working which displays Trackpad mapping correctly

image

Shouldn't it be a pretty easy fix to make GetLocalizedOriginPart return correct binding info too?

@AndersMalmgren
Copy link
Author

And if the SDK could give us the underlaying ptr to the icon that would be a huge plus so we can present it in our UI. But for now, lets get the string representation to actually represent the binding :D

@AndersMalmgren
Copy link
Author

@zite Any news on this?

@AndersMalmgren
Copy link
Author

@zite Now when the release is close you really need to fix this. I just tested with latest beta of steamvr. And the bug remains.

image

@AndersMalmgren
Copy link
Author

Bump. Just got feedback from a user that rightfully thinks that Trackpad is not helpful.

@artumino
Copy link

We also bumped into this issue. GetLocalizedOriginPart returns a generic "Trackpad" instead of the specific direction the action is bound to.

It also applies to actionset overrides. For example if we enable an actionset with a higher priority that has an action bound to the trackpad position it'll also disable all the DPad click actions, this doesn't happen if the lower priority action is a button click instead.

@8B0000
Copy link

8B0000 commented May 16, 2021

+1

@ChrisWarner103
Copy link

ChrisWarner103 commented Mar 4, 2024

I did a little bit of deep diving and managed to actually find the exact function that provides all of this data. Was quite hidden actually and was quite confusing on which data you needed to pass. But managed to get it working. It's the GetActionBindingInfo function. It will return InputBindingInfo_t which has all of the binding information you need in string format.

For example, was able to get all of this information from this function. Exactly what everyone has been wanting:
Unity_fEQdDL7xeO

This also works with all button types.

The variables that you will want from InputBindingInfo_t will be rchModeName & rchSlotName

@AndersMalmgren
Copy link
Author

AndersMalmgren commented Mar 4, 2024

Replying to #1017 (comment)

Did a quick check, is it possible to call it without changing vendor code? Seems to be internal stuff

edit: OpenVR.Input.GetActionBindingInfo

@ChrisWarner103
Copy link

ChrisWarner103 commented Mar 4, 2024

Replying to #1017 (comment)

You should just be able to call it like this:

			InputBindingInfo_t bindingInfo= new InputBindingInfo_t();
			uint returnCount= 0;
			OpenVR.Input.GetActionBindingInfo( steamVRAction.handle, ref bindingInfo, 512, 10, ref returnCount );

Then just use the bindingInfo to get all of the variables for it

@AndersMalmgren
Copy link
Author

,

Interesting, I get a NullReferenceException: Object reference not set to an instance of an object

But it also sets the struct data correctly before null reference error

@ChrisWarner103
Copy link

,

Interesting, I get a NullReferenceException: Object reference not set to an instance of an object

But it also sets the struct data correctly before null reference error

I had the same issue originally. It was due to having a SteamVR binding on both controllers. So Jump was bound on the left and right controller. It for some reason doesn't like having duplicate bindings

@AndersMalmgren
Copy link
Author

AndersMalmgren commented Mar 4, 2024

Replying to #1017 (comment)

We use the built in priority system alot. For example the menu action has a lower priority than the weapon actions. So if you hold a gun with the Valve Index you cant bring up menu on that hand until you let go of the weapon. Meaning menu action will be on both controllers.

Seems that the native function isnt stable enough for prime time

@zite
Copy link
Contributor

zite commented Mar 4, 2024

Hey folks, I'll take a look at this and see what we can do.

@ChrisWarner103
Copy link

Hey folks, I'll take a look at this and see what we can do.

Is there any update on this?

@zite
Copy link
Contributor

zite commented Mar 21, 2024

There's unfortunately a bug in that header file. I've updated the beta with a fix as well as easy access via action.GetActionBindingInfo(). https://github.com/ValveSoftware/steamvr_unity_plugin/releases/tag/2.8.1b

@ChrisWarner103
Copy link

There's unfortunately a bug in that header file. I've updated the beta with a fix as well as easy access via action.GetActionBindingInfo(). https://github.com/ValveSoftware/steamvr_unity_plugin/releases/tag/2.8.1b

I'll give this a test tomorrow. Thank you for taking the time to look into it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants