Search code examples
unreal-engine4oculusoculusquest

Empty Array of IMotionControllers for Unreal using Oculus Quest


The typical way of setting up a MotionController in Unreal Engine is through Blueprints, but I'm trying to identify different types of motion controllers for various VR setups and from there apply the orientation and position data. I have no problems getting Oculus Rift and Vive controllers and trackers using C++, but on Oculus Quest the array that's populated with IMotionControllers is empty when debugging over ADB. Why might this be?

The following code will print a length of 0 on Oculus Quest only.

const FName feature = FName(TEXT("MotionController"));
TArray<IMotionController*> controllers = IModularFeatures::Get().GetModularFeatureImplementations<IMotionController>(feature);
UE_LOG(LogGloveController, Warning, TEXT("Number of Controllers: %d"), controllers.Num());

Solution

  • I checked the array in the TickComponent update and the array was populated. There's just a delay sometimes for a controller to become available (even with Rift/Vive), but it always happens on Quest.