Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
Avengar's avatar
Avengar
Honored Guest
7 years ago

Detecting which controllers are plugged in

I'm currently working on detecting plugged in controllers for Oculus Rift and also for Oculus GO. Here is function that I've come up with:
(it's added to the OculusInput.cpp)

FString FOculusInput::GetPluggedControllerName()
{
FString ControllerType = "None";

ovrpControllerState4 OvrpControllerState;

if (OVRP_SUCCESS(ovrp_GetControllerState4(ovrpController_Active, &OvrpControllerState)))
{
switch (OvrpControllerState.ConnectedControllerTypes)
{
case ovrpController_Touch:
ControllerType = "Oculus_touch";
break;

case ovrpController_Gamepad:
ControllerType = "Gamepad";
break;

default:
ControllerType = "Default";
GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Red, FString::FromInt(OvrpControllerState.ConnectedControllerTypes));
break;
}
}

return ControllerType;
}
It works well when i have only one of them plugged in, it will never work if i have both touch and gamepad plugged in my pc. My queston is if it's there any way to split that? Do i have to just check those hexadecimal values before? Also how can i detect if it's Oculus GO controller?

1 Reply

  • mouse_bear's avatar
    mouse_bear
    Retired Support
    @Avengar

    Let me inquire within and try to get you an answer. I'll update you here once I get a response.