ValveSoftware / steamvr_unreal_plugin

SteamVR Input Unreal Plugin - Documentation at: https://github.com/ValveSoftware/steamvr_unreal_plugin/wiki Sample project (UE4.15-4.23): https://github.com/ValveSoftware/steamvr_unreal_plugin/wiki/sample/SteamVRInputPlugin.zip Sample Project (UE.424+): https://github.com/ValveSoftware/steamvr_unreal_plugin/wiki/sample/SteamVRInputPlugin_UEIntegrated.7z

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using the same action for both hands

Rectus opened this issue · comments

Looking at the input bindings for games like Half-Life: Alyx, and for every action that can be triggered by both hands, the same action is bound to both hands instead of having separate left/right actions.

Is it possible to set up actions the same way with the current UE4 implementation using Blueprint? Most actions would require you to know which motion controller triggered the action, but there doesn't seem to be any way of detecting it.

SteamVR Input seems to allow you to get the device ID for the action, but the MotionController component doesn't expose which device ID it uses.

Hi @Rectus - You should be able to just map both the left and right motion controller inputs to the same action in the Key or Axis bindings and that'd produce the same "mirrored" result. Or were you thinking of a different use case?

The issue I have with this is how to identify which motion controller performed the action. For example if you have an action to teleport, you need to know which hand to project the teleport beam from.

If I understand you correctly, the inputs should be set up like this:
bild

This results in SteamVR triggering the input events, but I can't see any way of telling which controller triggered it.

My motivation with this is to present a uncluttered set of controls in the SteamVR binding interface, and to make it easy for users to rebind controls on arbitrary controllers.

I ended up writing a library that gets the hand for the action origin directly from the OpenVR API.

The code is here in case anyone needs it:
https://gist.github.com/Rectus/9cc3ae996df5b4549a287a37af260674

Unfortunately this has exposed another issue. It's not possible for a single action to be active for both hands simultaneously. So if you have a single grab action that's active while holding down a button, when the left hand grabs an object, the right hand can't grab objects until the left hand is has released the button.

This seems to be an issue with how the UE4 action system is designed, so I don't think there is any way around it apart from redesigning the SteamVR Input plugin to allow multiple UE4 actions to be mapped to one SteamVR action.

I tried making a thread on the UE4 forums about this, but not sure if anyone from Epic read it.

It would be nice to have this working in UE4 since it seems like a good fit for the level of abstraction used the XR system, especially if it can be made to support an arbitrary number of inputs instead of just the left and right hand. Considering the input system in OpenXR is so similar to SteamVR Input, it would seem like a good feature to have going forward.

Hi @Rectus - sorry, i lost track of this ticket. But we do already have nodes for this in the SteamVR Function Library that comes with the marketplace plugin (and with the engine from 4.24 and above). Such as:

image

You can use the node right after the action is called (event) and you should get detailed info on which controller (and part/component) triggered the action (you should of course parse first before triggering the actual action instead of the print out, but just wanted to quickly demo the output in the sample project we provided):

image

You should get a result like this:

LogBlueprintUserMessages: [VRPawnSteamVRHand] squeeze Knuckles Left

You should be able to map and respond to the same action in both hands. It's also exposed in C++ so you can build on top of this or yeah, you're free to build your own library directly from the OpenVR API, though I suggest having a look first at the SteamVR BP Function Library header as we have added quite a few convenience nodes there that you might be able to use and not need to reinvent the wheel.

I tried making a thread on the UE4 forums about this, but not sure if anyone from Epic read it.

It would be nice to have this working in UE4 since it seems like a good fit for the level of abstraction used the XR system, especially if it can be made to support an arbitrary number of inputs instead of just the left and right hand. Considering the input system in OpenXR is so similar to SteamVR Input, it would seem like a good feature to have going forward.

There is an OpenXR call for this xrGetInputSourceLocalizedName, the Epic plugin isn't production ready yet so there's a bunch of BP nodes that are still missing. Have passed your feedback on and it looks like this is in their radar :)

Thanks!

I think the ideal solution would be something that's more device agnostic though, like passing the Motion Source name or a EControllerHand Enum. Something that lets you do a select statement for devices, or on the motion controller side check if this component is the one that sent the input.

There is also still the issue of overlapping inputs being blocked. I've looked at the code for the input system, and it seems to be an intentional decision to block the inputs when an action event node is set up to listen to a pair of Pressed and Released inputs (at least in version 4.26). I'm not sure what the use of this is, but a solution might be to add a new setting to event delegate to let overlapping inputs through.