XRSystem "Get Motion Controller Data" not working

Hello!

I’m having trouble getting the “Get Motion Controller Data” function to work.
I tried both Blueprint and C++ (GEngine->XRSystem->GetMotionControllerData).
But in both ways, the resulting data struct says that the controller is “Not tracked”, even though I can see move correctly in the VR pawn.
I’m leaving the “World Context” parameter empty / nullptr because I could not find any documentation what should be provided as World Context.
I also noticed that the “Device Name” is “OculusHMD” not the controller name.

Is the controller tracking “consumed” by the VR Pawn? Is there something that needs to be enabled for an Actor or Blueprint class to be allowed to use GetMotionControllerData?

Thank you!

GetMotionControllerData isn’t fully implemented on all XR plugins. Only the OpenXR and WMR plugins seem to have their own implementations, and all other ones go to the base implementation that just searches through all UMotionControllerComponents and tries to get data from them. I know the the tracking status reporting hasn’t been implemented in the stock SteamVR plugin, and it’s probably the same for the Oculus plugin as well.

To fix it, either switch to using the OpenXR plugin if possible, or modify your current plugin and implement GetMotionControllerData inside it.

Thank you for your reply! However, if I create a new project with the VR starter content, then “GetMotionControllerData” works normally even on the same machine with the same plug-ins. So it must be something in the project settings or in the initialization of the game when started. But I can’t find anything that could be related. (As I said, the tracking works and the controllers are visible). Only “GetMotionControllerData” isn’t working and always returns “0,0,0” as controller position.

That might be due to how the base implementation works. It iterates through all spawned UMotionControllerComponent objects and pulls the information from the first one that matches the hand. Since it relies on spawned components instead of directly querying the XR system, it may fail if you don’t have everything setup the same way as the template project, or if multiple components get spawned somehow.

Thanks you so much again for your reply! I have implemented the motion controllers according to this official guide: Motion Controller Component Setup | Unreal Engine Documentation
So there is only one UMotionControllerComponent for each hand.
The template contains a lot of other things (like teleportation), but I cannot find anything in it that would enable or break the GetMotionControllerData function.

Yeah, it could also be something related to the state of the components, or something else entirely causing the issues. If the active XR plugin changes, it will also cause it to behave differently.

The main issue is that the base implementation relies on the game state when there is no reason for it to do so. It can cause all kinds of unpredictable issues from changes to unrelated systems during the development cycle of the app. I wouldn’t recommend using it, apart from with OpenXR or if you have a custom implementation in place.