VR - C++ How to get LeftAim/RightAim motion sources for motion controllers

Hi folks.

I’m trying to create a VR Character class and so far I have been able to add two motion controllers for Left & Right motion sources. However, I’m trying to find LeftAim & RightAim ones but apparently, FXRMotionControllerBase doesn’t have them.

LeftMotionController->MotionSource = FXRMotionControllerBase::LeftHandSourceId;
LeftMotionControllerAim->MotionSource = FXRMotionControllerBase::LeftHandSourceId;

Is FXRMotionControllerBase the right class or are they located somewhere else?

Also, not sure if this is completely valid for an OpenXR implementation.

Any help would be very much appreciated.

The OpenXR specific ones are under the OpenXRSourceNames namespace. The MotionSource property is just a FName though, so it should be possible to just pass in a string.

which header needed? my code doesn’t recognize this namespace.

My bad, looks like they are stuck in \Engine\Plugins\Runtime\OpenXR\Source\OpenXRInput\Private\OpenXRInput.cpp
Seems they are not accessible outside the file. Seems like the code uses inline FName declarations in other places.

Thank you very much for checking.

I just looked at the motion source names in the pop-up of MotionController component in BP view, and then used the one I want directly in C++. e.g.

LeftController->SetTrackingMotionSource(FName("LeftAim"));

1 Like