Skip to main content
New Participant
June 15, 2018

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

mousebear
Honored Contributor
June 20, 2018
@Avengar

Let me inquire within and try to get you an answer. I'll update you here once I get a response.
If you need immediate help or want additional support/context on an issue you are having with our platform or integrations: 1. Gather any and all logs , screenshots, and version numbers of relevant software (Oculus SDK, engine, etc.) 2. Please submit a ticket here through the "Contact Us" link (include what you've gathered in step 1). 3. Tag me @mouse_bear once you have done so!