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)
(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?
