Hello everyone, im trying to port my application to VisionPro and one of the features that im trying to port is to open application MainMenu when pinch on space (not targeting any object)
i followed tutorial and trying to use UnityEngine.InputSystem.EnhancedTouch.Touch to detect when activeTouch count > 0 but seems that activeTouch.count is only available when clicking an object… it will always be 0 if not looking/clicking on a object…
Is there any way to detect Pinch on Empty space?
Any help will be appreciated… thanks in advance
Rafael
protecte void Update()
{
var activeTouches = Touch.activeTouches;
if (activeTouches.Count > 0)
{
// Logic here to detect if touch contains target
}
}
If it’s an app in the mixed reality space no it is not possible (visionOS restriction). Detecting a pinch without a target is only possible in a fully immersive (VR) app.
One work around I’ve seen is to have a large collider either in the distance or near the user to always catch pinches. This has other complexities but can be an option depending on your setup.
4 Likes
Thanks for the quick answer… i managed to fix it including a HUGE invisible box collider on far distance of main camera to handle clicks on space.
1 Like
Interesting question, but I would think the huge box might be prone to trigger many false empty pinches?
Well, its not a perfect approuch but it works for my use case.
2 Likes
I had the same problem. I found out I had to turn off the near/far interactors far casting, since they won’t cast a ray towards your head. Then I had to detect the pinch signal manually when the palm was facing my head. used vectors to figure out if the palm ray was close to hitting my eyes…