[1493] InputManager.GetLastUsedInputMethod() doesn't allow anymore to recognize specific controllers
Shiro K
Until yet, I used InputManager.GetLastUsedInputMethod() to recognize a Vive, Quest or Index controller. I need this for a customized vehicle control which differs per controller. That broke with the Steam Input 2.0 update. The method now returns always 18 (also with the SDK 3.7.0). Is there no way anymore to recognize the controller type?
Log In
Activity Feed
Sort by
Shiro K
To give some more context: The VRChat interaction fails at high movement speeds and for this I built my own interaction system. Some input types needs auto hold (mouse, XBOX, VIVE), other are held naturally by the hand/finger position (Index, etee...). Also, some controllers fires the InputDrop event, others not. To be able to rebuild the default behavior I need to know the type of controller the player uses.
In meantime I found a workaround to detect a certain controller. The method works for VIVE and Index. etee is not tested yet and the method is certainly not complete, but it is a starting point:
/// <summary>
/// Returns true if a controller of the checked types is found.
/// </summary>
/// <param name="vive">Checks for VIVE wands</param>
/// <param name="index">Checks for Index controllers</param>
/// <param name="etee">Checks for etee controllers</param>
/// <returns></returns>
public bool HasControllerOfType(bool vive, bool index, bool etee) {
string[] controllers = Input.GetJoystickNames();
foreach (var controller in controllers) {
if (vive && controller.ToLower().Contains("vive"))
return true;
else if (index && controller.ToLower().Contains("knuckles"))
return true;
else if (etee && controller.ToLower().Contains("etee"))
return true;
}
return false;
}