Magnetic Pinch with Leap Motion Orion

And why it is nearly impossible (yet) to throw things in VR like you do in real life.

Felix Noller
Aug 14, 2016 · 4 min read

With the original Leap Motion SDK came the Magnetic Pinch, a script that allowed to grap an object closest to the hand so you could throw it around. You can still get it on Github. Yet, with the new Leap Motion Orion (it’s a pretty good option for VR hand tracking. Go check it out!) the script is no longer working. The closest you will find in the latest release is a Pinch Detector, however, it does not allow to select single objects, nor throwing them around.

Throwing a sphere in VR

For anyone new to VR, Unity and the Leap Motion, it can be quite tricky to get virtual hands to the point where they can pick up objects and throw them. I will present a solution here (go find the code at the bottom of this page). I am not a professional coder, so the code may lack performance and beauty, yet it should be easy to understand. It takes snippets from the original Magnetic Pinch (thanks Leap Motion!) and may just need a tiny bit of additional polishing (English is not my native tongue but I think it would be right to say “… a bit of polish” here. However, that sounds strange and you wouldn’t have to speak polish to understand it…). Oh, and if you are really really new to VR and Unity, have a look at my very first story:


What does it mean to throw objects in VR

Grabbing an object and throwing it in VR

Looks weird? I don’t really grab the sphere here, I know. I intend to grab it, but then it just wooshes out my hand and attaches to a point somewhere at the back of my middle finger. Altough this looks not correct, it is intentional. Putting the sphere inside your hand makes it much harder to keep control of throwing speed, distance and trajectory. Try it yourself (adjust the code so that “IsKinematic” stays true just until you release the object). Having the sphere attached outside your hand lets you better control its behaviour. If you try, keep calm! Don’t be too quick! Slooowly! And always keep the object in the center of your visual field. Voilà, you are a 2-year old again, learning how to throw a ball.

Throwing objetcs in VR just doesn’t feel like it does in real life, and you need some extra training which makes it much less intuitive. I think there is a couple of reasons for that:

#1, you miss out on haptic feedback (be careful of the wall/table/chair infront of you).

#2, usually, when you throw things in real life, you move your hand to gain momentum (in VR you can do this inside your visual field, without a problem), then you move your hand quickly towads the target and release the object. Here, at least, you usually loose visual track of your hand for a few milliseconds. This is not a problem in real life because you sense other things that make your shot complete. For the Leap Motion, however, any time your hand leaves the tracking area, the cameras loose track, too. In VR, you will soon recognize that you always have to keep your throwing motion in focus. Always! And this just doesn’t feel very natural…

#3: It is quite difficult for the object to know your intentions. Usually, the object should travel the way your hand moves, once you release. Therefore you would need code that predicts your hand movements. As I said earlier, I am not a professional coder, so instead of trying to predicting the future, the script presented here lets the object always lack behind the pinch position; this is to let it gain momentum. However, it requires some learning if you really want to hit a target.


Let’s get to the script

Add a Rigidbody to any object that you want to interact with and enable “Is Kinematic” if you want your hand to reach into the object instead of pushing it away, once you grab for it. Also, don’t forget to add the Magic Leap Orion’s PinchDetector to your virtual hand.

I wrote the script during the process of a thesis project. I’ll soon release the results of my evaluation and post some design principles for VR interaction models. Hope this snipped here helps you doing some great interactive VR work and I hope you’ll like what will come in the future!

Felix Noller

Written by

Felix Noller is a Human Factors Researcher, Interaction Designer and Tech Enthusiast, working and exploring at Method Inc in London.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade