CAVEAT: Requires some understanding of C# and some gray matter. Also, this is meant as a basic quick how-to not an exhaustive analysis. We take no responsibility for you doing something stupid, or for actually following this to the letter and it still resulting in a cataclysmic implosion of doom and despair.
Here we go:
- download the Leap Motion SDK
- Install the C# assemblies in your Windows GAC [list]
- To do this, find the LeapCSharp.Net4.0.dll and LeapCSharp.Net3.5.dll in the LeapSDK/lib folder
- Install them using the gacutil.exe tool that comes with Visual Studio or the Microsoft SDK (google to find out more)
- Open a cmd window as administrator, go to where gacutil is (often in C:\Program Files (x86)\microsoft SDK\something..)
- The syntax is gacutil.exe –i C:\fishstick\spoon\LeapCSharp.Net4.0.dll
- Repeat above for 3.5.dll
[*]Copy the Leapd.dll and Leap.dll (and maybe LeapCSharp.dll?) into your Ventuz folder.
[*]Done! Now Leap is useable by Ventuz. Congratulations.
[*] Oh. You want more?
[*] Okay, fine. Fire up the Leap Drivers.
[*] Next start a Ventuz Scene and get a text node and an axis and create a script node.
[*] Add the Leap Assembly to your script
- Open the script node and click on References on the bottom of the left panel
- Right click on GAC Assemblies and click Add Reference
- Find LeapCsharp.NET4.0 and click okay
- Done
- Open the CSharp example in the LeapSDK folder and copy it
- Paste it into the Ventuz script, not deleting any of the Ventuz stuff.
- Let’s start easy
- Comment out the whole class Sample bit they gave you, we don’t need that for now. (or delete it, if you prefer, but we’re going to be stealing that stuff, so might want to keep it around). But leave the SampleListener class uncommented, we need that!
- From the sample class, steal the lines:
-
Code: Select all
SampleListener listener = new SampleListener(); Controller controller = new Controller();
- And paste them above private bool changed; in your class Script bit
- to your Script() section.
Code: Select all
Add controller.AddListener(listener);
- In the Dispose() section, add
Code: Select all
controller.RemoveListener(listener); controller.Dispose();
- Done
-
- Now we need it to do something.
- Add an Output Variable to the Script
- Click on custom model, outputs, then add a float called Fingers
- Now, add the following to the top of the Generate() section (before the if bit) (code is all stolen from the Sample class):
-
Code: Select all
Frame frame = controller.Frame(); Hand hand = frame.Hands[0]; FingerList fingers = hand.Fingers; Fingers = fingers.Count; changed = true;
-
- Unless you (or I) have made a Fubar, you can save and close, and if your leapmotion is connected, the script will be outputting the number of fingers – bind that to the text node and voila, you have Leap Motion in Ventuz (a bit un-sexy, I know, but hey, first steps, right?)
[*] Go forth. Write if you find work.[/list][/list]