I’ve been searching high and low, but have so far been unable to find a definitive explanation on how to determine which button was clicked on a XR controller touchpad (HTC Vive in my case).
As far as I can tell, touchpad clicks only produce a single value (0 or 1) with no indication of which specific button was clicked (up/down/left/right). I had assumed touchpad clicks would be treated just like the D-Pad on a gamepad controller with each button generating a unique value, but apparently this is not the case.
Following another thread - New Input System: Detect Touchpad click North/South (WMR/ Vive) - I’ve tried setting up a composite action using one modifier combining both the touch and the click actions of the touchpad, but have only ever been able to produce the single, indistinguishable button press value. It mentions maybe needing to write a custom script, but I’m not sure how to go about doing that as I’ve only ever used the Input Actions UI editor for defining actions.
I do have a workaround in my input handler class which feels like a hack. Basically, I have a separate action defined for touchpad touches and I store the axis when the touch event fires. Then, when the click event fires, I check the stored axis from the last touch to determine which button was clicked. The problem is, I’m guessing there is no guarantee of receiving the touch event before the click event because it does not work 100% of the time with some clicks not registering or the wrong axis is reported.
Could anyone point me to a “proper” working solution that can be done with a single action? Any help would be greatly appreciated.
Thanks