Primate: Leap Motion for Grasshopper

This is Primate, the 1st plug-in to integrate Leap Motion with parametric design in Grasshopper.

This component library of Primate includes:

  • Component for counting fingers
  • Component for counting hands
  • Component for tracking a pointing finger
  • Component that tracks the direction of an extended hand
  • Component that tracks a palm and the vector normal to a palm
  • Component that mimics the sphere described by a cupped hand

Each component pulls in a slightly different piece of data from the movement of your hands in real time. The direction of the fingers and palm, as points and vectors and even spherical or other 3 dimensional data become parameters in Grasshopper.  These components give you the power to feed this data into geometric algorithms for your own programming or design.

You will need the Leap Motion Controller to run Primate.  

The example file uses Kangaroo components to run the time sequence.

Primate has been tested, but this is the first release. Please use it "as is", it does not come with warranties.

To install:

  • Move the ExampleFile folder to a folder outside of the Primate_1 folder.  
  • The remaining Primate_1 folder contents should be added to Rhino loading by typing GrasshopperDeveloperSettings in Rhino and adding a reference to the Primate_1 folder.  
  • Restart Rhino and Grasshopper
  • Open the Example File Primate-Grid-Demo in Rhino and Grid-Demo-Primate in Grasshopper to run the example demo.  

You can find some of the ideas behind Primate and a simple demo video here.  A more advanced example file, demonstrating an interactive array of planes on a lofted surface, can be downloaded here.  

Please give feedback!

- Mitch McEwen, Principal, McEwen Studio

Primate is developed by McEwen Studio | Brooklyn, NY

Support Email: 4FQ.FGPHKA3YXYQ4@YKS4GLD@
Plug-in rating:
Average: 4.5 (2 votes)
Title Release Notes
Primate 1.001
Includes latest Leap dll files (from Leap 0.8.1).  
Version: 1.001
Language: English
Primate .9
You will need the Leap SDK in addition to these files to run Primate.  
Language: English
Primate 1.000
Primate_1 includes the necessary Leap SDK files. Motion recognition has also been improved by removing the intialization of most variables at 0,0,0.  
Version: 1.000
Language: English
Plug-In videos:
Homepage: McEwen Studio


Hi there, Your plugin have great potential, thank you very much for your effort,

I just keep getting this error 1. Solution exception:Could not load file or assembly 'LeapCSharp.NET4.0, Version=, Culture=neutral, PublicKeyToken=6e1b1368e71eba9b' or one of its dependencies. The system cannot find the file specified.

I've installed the latest firefly and grasshopper plugins

hi, thank you very much for this plugin. but I got a problem with running the example file, it says: 

1. Solution exception:Could not load file or assembly 'LeapCSharp.NET4.0, Version=, Culture=neutral, PublicKeyToken=6e1b1368e71eba9b' or one of its dependencies. The system cannot find the file specified.

my leap motion can work with other software and I have installed the netframework 4.0, my operating system is windows 8.0, doesn't it work with window 8?

Hi Zhoule. I am having the same problem. Did you find a solution?

Have you installed the lastest version of Firefly?

bebetigno's picture

I am very interested in your project, congratulations nice work! is possible to track 2 or 3 fingers at the same time.

mcewen's picture

Thank you.  [I'm a couple months behind in the next rev of Primate, partially because I got a Visiting Professorship teaching Urban Design this semester, totally outside of this scope of research.]  In addition to giving access to Leap's native gestures (eg circle and swype), the next rev of Primate will give more detailed access to the finger data in Leap.  Keep up the suggestions. 

Also, here's a great demo video from Frantxo Tabanera Asensio that includes some Primate components, much better than the demo videos that I have posted.


It's really amazing just thinking about the capabilities of primate+leap. I am really keen on working out amazing interactions. 

I'm just a power-user not programmer, so I'll use a basic language to describe the problem. I think some questions mentioned that before.When you start connecting other than one controller (let's say started with count fingers and add palm) after some time it starts blinking. (That means constant null output) Also even if you disable controllers and leave only one it goes on blinking. This sounds like the problem is about memory but I really don't know how to manage it.

There might be a way to call previous successful data (in this context successful means not null) with culling but I think other than finding a way around with extra connections, need to understand why this flickering happens. Is there a setting to minimize that? Also do you know does exposure effect the quality of readings in LeapMotion? 

mcewen's picture


Thanks for your positive attitude and your detailed critique.

Exposure seems to be a problem for the Leap, irrespective of Primate.  I have noticed this in various light conditions, and I don't have a clear answer for you on that.  Check the LeapMotion website, I think.

As far as your points about Primate - yes, this is the most significant issue.  I agree, it does seem to be memory related.  I am running Grasshopper on an Intel core i5 processor on a laptop, and I have yet to try Primate on an i7 or more powerful machine.  What I have done so far to deal with this is to adjust the frame rate - lower it until you can get what you want.

I am working on this for the next rev of Primate, which references gestures that Leap understands natively.  




I can't wait to see the next version, it has so much potential. Appreciate your sincere answers. 

mcewen's picture

New example file available for download as a zip file here and new Demo video including array example finally up.  Next demo to show vector field. 

In the same vain as the question about noise, though this has to do with the rec function. I notice when I have the ‘record’ node set to unlimited data, after a few seconds of recording data it seems to interfere with the ability of the “CountFingers” node from Primate. Suddenly the number jumps from 0-5 over and over, even if my hand is stationary and all 5 fingers easily spread apart and easy to recognise.  This changes when I set any limit to the ‘record’ node. This seems impossible to interfere with the finger counter as the record node is further down the hierarchy and unable to feed information back within grasshopper.  Thoughts?

Look forward to the video.


mcewen's picture

Jason, my hunch is that this has something to do with how Leap data is stored in the cache.  For example, I notice that when the Leap Control Panel autoloads on my laptop when the Leap is not plugged in, it freezes any other program trying to open until it can process that the Leap is not there and show the related message.  

I have the barest of dialogs going with the Leap developer team, so I can start to ask them questions about things like this,

But, in the meantime, I would stick to the limits you have discovered.  I also tend not to put the counter reset below 20 milliseconds, for similar reasons.

Extended demo video coming soon!  Please also keep sending comments and feedback, as I'm working on the next rev of Primate for the fall. 


thanks for creating this plug-in, excited to see what we can construct with it. I'm wondering why the default movement for forward and back hand gesture is set to control the Z- and Z+ position. Seems more intuitive to have this gesture control the -Y and +Y direction and leave raising and lower your hand to drive the Z position. I may be bias on this as I am working in the 3rd dimension more oftern then a set 2 dimensional plan view. Yes it's easy to adjust (to have it my way!;)) but curious none the less.

thanks...keep it up


mcewen's picture

You can change the axis assignments in the Leap settings!  Primate code only translates from Leap vector to Rhino vector x to x, y to y, etc.  I agree with you, the assumption of X, Y, Z direction is odd, but it probably has something to do with gaming.

I will (finally) post a more extensive video with an additional example file next week, and will show a bit of the Leap settings, too. 


Is there anything that can be done to limit the noise in the feedback? I'll keep my hand still and grasshopper results in a wide range of constantly changing numbers...that's what's stopping this from being useful for camera control for instance.

mcewen's picture

Thanks for working with Primate.

My goal is to keep the components as bare as possible, so as not to unnecessarily duplicate amazing work that's been done in Kangaroo and other plugins.  So, short answer:  you can limit the 'noise' however you like in the Grasshopper definition.  Cullpt, for example, is a good one to try.  Culling in general is very useful.

As far as what the 'noise' is - it depends on which Primate component you are using.  You set the number of milliseconds between each update in the Grasshopper definition.  The ability to read the frame data and process it through your definition at that speed is partially dependent on Leap and partially on your processing hardware.  This is another reason I am trying to keep the components as bare as possible for now, so that demanding definitions can run in real-time on laptops.  

Some Primate components are already doing more work than others.  For example, if what you want is a high-frame rate read of points or vectors in real time, I would stay away from the Pointer component.  That one uses multiple steps within the controller to look for the furthest pointing finger or provide an average of all fingers, if it can't locate a pointer.  Palm is better for high frame-rate real time. 




mcewen's picture
mcewen's picture

If anyone has problems with an pInvoke error with the Leap dlls, try:


1) Try a FULL computer restart.

2) Also install the newest grasshopper - even though the version numbers are the same (9.56)   some sub-version index needed to be pushed up from 2 0001  to 2 0002.


3) Please reference the instructions in the Readme file or the updated instructions above.


There may be an issue with Leap updating automatically and Primate referencing previous version Leap dlls, if they are not backward compatible.  Look here for a minor update soon (Primate 1.001) if you have red components and the above 3 steps don't help.

norxz7777's picture

i found a simple solution by copying three required leap dll into grasshopper component folder. it works for me. hope it can help.

mcewen's picture

Please send an error file or a screenshot of the error to so I can help you directly!   

mcewen's picture

Try toggling off "Memory load *.GHA assemblies using COFF byte arrays" in your Grasshopper Developer Settings (above Library Folders)

norxz7777's picture

no, not working, i tried and it ended up the same. 

norxz7777's picture

great tool for leap motion! but the component keep showing "leapCSharp.Net4.0 can't be loaded" in grasshopper, I've added the folder contains the leap file in GrasshopperDeveloperSettings. it just doesn't work, anyone can help?


deisengard's picture

What finally fixed this for me was right-clicking on each of the DLLs (individually), going to Properties and clicking Unblock.

Protected Collaborative Environments
© 2016McNeel Europe. User-submitted content and trademarks property of their respective owners.