How to implement Palm grab in visionOS(i.e like a Beat saber style gestures)?

Hi All,

I was trying to develop a beat saber style game on vision Pro. I need some help regarding gestures implementation i.e How to grab left and right saber with palm grab.

Can anyone provide some guidance on this?

Thanks in advance.

Hi there! Thanks for reaching out with your question. Hopefully we can sort you out, and let this post serve as a beacon of light for fellow rhythm enthusiasts :laughing:

Have you explored the Custom Gestures feature of the XR Hands package? That’s probably the best out-of-the-box system for detecting a wide variety of gestures, and I think the samples include a grab gesture.

If that seems too complicated for what you’re trying to accomplish, you can replicate what it’s doing pretty easily in code. Take a look at the HandVisualizer component in the visionOS XR Plugin package samples. It demonstrates how to get access to the hand data. In the case of the visualizer, it also instantiates a prefab for each joint and tracks joint poses every frame. You can get rid of all that (or just leave it… visuals are nice :slight_smile: ) and just use the data.

Now that you have the data, you’ll want to compute some angles angles for a variety of joints (for grab, maybe just the angle between the proximal and intermediate joint of each finger), and define a threshold for each one. When all of them are below the threshold, grab = true!

Any solution for grab detection on visionOS will boil down to this kind of thing. You need to interpret the raw hand tracking data since the OS doesn’t provide a grab gesture. You’ll probably want to improve on the “naive” implementation I described here. For example, maybe you want a small “activate” threshold and a slightly larger “deactivate” threshold, so your grab state doesn’t “bounce” (turn on and off quickly) when the user’s fingers are near the threshold. That’s why I’d recommend going with the custom gestures feature in XR Hands. :slight_smile: