OpenXR Get MotionController Types / HMD Type

Hey guys.
I´m currently trying to figure out what kind of Motion Controllers / HMD the Player is using so I can adjust the shown Meshes etc.

Using OculusVR / SteamVR there were some C++ / BP Functions helping with that but for OpenXR I can´t seem to find anything useful.

Has anybody got an idea where to retrieve these information?
Thanks!

Edit:
By the way, I´m using the UE4 4.27 Preview 2 at the moment.
As it says that with 4.27 OpenXR now is production ready I wanted to make the move there.

Hey @ArvurRobin this hasn’t been exposed in the plugin yet but will be in the future.

Here are some suggestions on what’s currently possible in 4.27:

You can use the Device Visualization feature on the MotionController components to render the correct model for the device that’s being used. As a note we’re working on exposing more functionality and features here (such as getting access to the material being used, collision, etc).

You can “break key” from an Action Input and return which Key was used (Oculus, Vive, Index, etc) and make determinations from that.

We’ve also updated Get HMD Device Name to properly return names for all OpenXR supported HMDs.

3 Likes

Just tested this with a Valve index. Get HMD device name returns “SteamVR”.
With an Oculus Get HMD device returns “Oculus Rift S”
…Still wanting to detect index or Vive

Hey Bruno, the query for Get HMD Device Name asks the runtime, and we get what the runtime returns. However, you can break the Key output from an Input Event like so:
image

The user could always emulate the interaction profile of an Index controller even if they’re using a Vive, but that’s rare and would mostly be used for hardware that doesn’t even exist today, trying to emulate hardware that did and the application built support for.

And you can also use this function to query the current interaction profile at any time:


Just know that the interaction profile isn’t always set on Begin Play, so you might want to wait a frame or two before you query it.

1 Like

This doesn’t seem to work. When multiple controllers are assigned to something like “Shoot” then pressing shoot always returns the interaction profile of the device added most recently.

What do you mean “added most recently”? You can only use one XR system at a time.

image
So here, my Vive controller reports “Cosmos” as it was the last device added to the ConsumeIonLeft input. If I delete Cosmos L X Press from the list, it will then report as Valve Index, and so on.

I think if you replace Vive (L) Trackpad with Vive (L) Trackpad Up, the OpenXR runtime (you’re using SteamVR, yes?) will pick the suggested Vive Bindings instead of Cosmos/Index. I think if you were to reorder Cosmos/Index, it would still pick Cosmos first, as that’s the suggested binding that the Runtime seem to prefer.

Yes, I’m using SteamVR. But it still says Cosmos on Vive (L) Trackpad Up, and indeed, switches to Valve Index if I remove that binding and re add it (so its at the bottom, beneath the Cosmos entry.)

And the SteamVR plugin is disabled? Thanks for the details btw.

Disabling SteamVR fixed the issue, its reading Vive now. Although now I’m getting all kinds of problems from not having it, like the haptic effects continuing to go at a low rate for 3 seconds after they’re called to stop, (and the controller offsets are different now but that should be as simple as changing my weapon mesh’s relative location.)

Good!

I’ve had others report this, can you show me what your haptic effect looks like and how you’re calling it?

OpenXR has defined standard poses for the controllers. There’s the “Grip Pose” which is what we’re using for the MotionController component, and there’s the “Aim Pose” that’s used for something like a teleport or menu trace. Take a look at the VR Template and how they’re implemented there for reference.


Either of these work the same, on trigger pull it runs the true branch on on release it runs the false branch, when stopped it keeps going for 3 full seconds at a low rate.

I just opened a new 4.27 project with the VR template and my Vive controllers are doing the same thing on that project. Pull the trigger on one of the guns and it vibrates for what seems like forever.

Edit: Just opened the VR template in UE5.01 and have the same issue.
Oddly, in the template trials, if I hold down the trigger it vibrates consistently for the full 3 seconds and then stops, but if I hold for like, 1.5 and release it will stop when it’s released despite not having any code I can see suggesting it should stop on release. If you just tap it quick on and off, it will rumble for the full 3 seconds and then stop.