cancel
Showing results for 
Search instead for 
Did you mean: 

Check if touch controller got plugged in/out

Avengar
Honored Guest
Hello there!

I'm looking for a way that my game can use to check if touch controller got plugged in or out. I've searched the forum and found something about sensors but it's not my case.Also checked some code in plugin but couldn't find anything helpful. Anyone can provide me some help with that?
2 REPLIES 2

Avengar
Honored Guest
So i was searching through the code and found this:

typedef enum ovrControllerType_
{
    ovrControllerType_None      = 0x00,
    ovrControllerType_LTouch    = 0x01,
    ovrControllerType_RTouch    = 0x02,
    ovrControllerType_Touch     = 0x03,
    ovrControllerType_Remote    = 0x04,
    ovrControllerType_XBox      = 0x10,

    ovrControllerType_Active    = 0xff,      ///< Operate on or query whichever controller is active.

    ovrControllerType_EnumSize  = 0x7fffffff ///< \internal Force type int32_t.
} ovrControllerType;

and also this:

ETrackingStatus FOculusInput::GetControllerTrackingStatus(const int32 ControllerIndex, const EControllerHand DeviceHand) const
{
ETrackingStatus TrackingStatus = ETrackingStatus::NotTracked;

if ((int32) DeviceHand < 0 || (int32)DeviceHand >= 2)
{
return TrackingStatus;
}

for( const FOculusTouchControllerPair& ControllerPair : ControllerPairs )
{
if( ControllerPair.UnrealControllerIndex == ControllerIndex )
{
const FOculusTouchControllerState& ControllerState = ControllerPair.ControllerStates[ (int32)DeviceHand ];

if( ControllerState.bIsOrientationTracked )
{
TrackingStatus = ControllerState.bIsPositionTracked ? ETrackingStatus::Tracked : ETrackingStatus::InertialOnly;
}

break;
}
}

return TrackingStatus;
}

My question is pretty nooby but how can i access FOculusInput in my code? 

kersk
Expert Protege
You can also do "if (OVRInput.IsControllerConnected(OVRInput.Controller.Touch)) { // both Touch controllers are present }"