We are trying to write a global handler for click/airtaps using MRTK2.
We are using BaseInputHandler, IMixedRealityPointerHandler, IMixedRealityInputHandler which works fine when clicking on an asset with a collider - but how do we pick up taps when there is no collision e.g. just clicking in the air? Thanks
You have to use IMixedRealityInputHandler
and as a result of this OnInputUp
and OnInputDown
. This should work also witout any colliders. I'm using this to differentiate between spatial mesh and everything else. Clicking into empty space also triggers OnInputUp
and Down
.
if (_gazeProvider.GazeTarget?.layer == 31){ ... }
else
Debug.Log("Hit surface with layer: " + _gazeProvider.GazeTarget?.layer.ToString());