Discuss Scratch

khanning
Scratcher
34 posts

Scratch 2.0 plug-in for Leap Motion

Connect the Leap Motion Controller to your Scratch 2.0 projects!

Currently Scratch 2.0 Experimental Extensions are only supported with the offline version of Scratch 2.0.
Download the Scratch 2.0 Offline Editor and Adobe Air


Screenshot/Video

https://www.youtube.com/watch?v=Wxcme68biJE

Instructions (In no particular order)
  1. Launch Scratch 2.0 plug-in for Leap Motion
  2. Connect Leap Motion Controller to USB
  3. Open the Scratch 2.0 Offline Editor and try out some of my Sample Projects

Adding support to your Scratch 2.0 projects
  1. Save the LeapMotion.json file to your computer
  2. Open your project in the Scratch 2.0 Offline Editor and switch to the editor mode
  3. Hold the Shift key on your keyboard and click on the File menu at the top of your project window
  4. Click “Import Experimental Extension”
  5. Choose the LeapMotion.json file
Now you'll have access to the “Leap Motion” blocks under the “More Blocks” tab!

When you save your project the LeapMotion.json file is saved with it, so you only need to import it once.


Download

Download from the Leap Motion Airspace store

- or -

Bundled with Java (~150 MB)




Java not included (~5 MB)
Requires you to have Java 1.6 or greater installed on your system




Source

http://github.com/khanning/LeapScratch


Sample Projects

Scratch20PlugInForLeapMotion_SampleProjects.zip


Changelog

v1.0.0 (Airspace release) - 10/16/2013
- Major update for Airspace store
v1.0.0 - 8/19/13
- Re-written in Java (runs quite a bit faster)
- Created native executable wrappers for Mac and Windows
- Hand #2 remains Hand #2 even if Hand #1 leaves the frame.
v0.3.0 - 8/14/13
- Added simple graphical interface
- Added –nogui argument to run without the graphical interface
- Added boolean ‘Visible ?’ block for each object so you know if its visible in the Leap Motion frame.
- Other various fixes and cleanups
v0.2.0 - 8/3/2013
- Fix typo for Windows x86 libs
- Added ‘Tool’ blocks to track one tool (pencil, stylus, chopstick, etc) in each hand
- Renamed the blocks to make more sense
- Added a ‘Hand Open?’ boolean block for each hand
v0.1.0 8/2/2013
- First Release
- Changed to stabilized finger and hand positions
- Linux SDK doesn't support stabilized positions


Leap Motion - http://leapmotion.com

Last edited by khanning (Oct. 16, 2013 18:14:25)

technoboy10
Scratch Team
1000+ posts

Scratch 2.0 plug-in for Leap Motion

Awesome! Can't wait to play around with this.

my github | my blog | scratcharchive.cf
“I may not have gone where I intended to go, but I think I have ended up where I needed to be” -Douglas Adams
khanning
Scratcher
34 posts

Scratch 2.0 plug-in for Leap Motion

I just made a small change that improves hand and finger accuracy. If you happened to download this before 1:50pm EST today you should re-download the package.
khanning
Scratcher
34 posts

Scratch 2.0 plug-in for Leap Motion

Updated today to add tracking for one tool in each hand. A tool can be any object like a pencil, stylus, chopstick, etc.

I also added boolean blocks ‘Hand-1 Open?’ and ‘Hand-2 Open?’ to detect if each hand is open or closed.

I changed the naming structure of the blocks to make more sense. You would have to reupload the .json file to your project for the new blocks to show up.

Demo projects for the new ‘Tool’ and ‘Hand Open?’ blocks are posted in the studio.
http://scratch.mit.edu/studios/236466/

I also created a studio that anyone can add projects to. If you create a project with LeapScratch and you want to share it please post it there!
http://scratch.mit.edu/studios/237132/
learnegy
Scratcher
100+ posts

Scratch 2.0 plug-in for Leap Motion

Very interesting technology. Is the Leap Motion SDK only in Python or are their other language options?

For those interested in how Leap Motion works, you can find more information on WikiPedia.




2.0 Alpha Tester • Scratch instructor and fan!

“Some like to build and some like to play. You can do both with Scratch every single day.”
kevinchristopher
New to Scratch
2 posts

Scratch 2.0 plug-in for Leap Motion

Great stuff

Does anyone know a simple way I can get a Leap interface for kids to use without having to run a program in a command prompt?
technoboy10
Scratch Team
1000+ posts

Scratch 2.0 plug-in for Leap Motion

learnegy wrote:

Is the Leap Motion SDK only in Python or are their other language options?
According to the Leap Motion developer site, there are APIs for C++, C# and Unity, Java, JavaScript, and Python.

my github | my blog | scratcharchive.cf
“I may not have gone where I intended to go, but I think I have ended up where I needed to be” -Douglas Adams
khanning
Scratcher
34 posts

Scratch 2.0 plug-in for Leap Motion

Updated LeapScratch today with a simple graphical interface. It also accepts a –nogui argument if you want the old console interface.

I also added a “Visible ?” boolean block for each object. (ex “Hand-1 Visible ?”, “Finger-1-Hand-1 Visible ?”). This block tells you if the Leap Motion can see the object in its current frame.

kevinchristopher wrote:

Great stuff

Does anyone know a simple way I can get a Leap interface for kids to use without having to run a program in a command prompt?

The Leap Motion could be directly integrated into Scratch 2.0, but that would have to be done by the Scratch team. For now we need a helper program (like this) that receives data from the Leap Motion and sends it on to Scratch 2.0.

I think it's never too early for kids to start learning basic command syntax. However, it could be made easier by setting up a simple clickable script or executable that launches the LeapScratch python Script. What platform are you using?
kevinchristopher
New to Scratch
2 posts

Scratch 2.0 plug-in for Leap Motion

I am working in Vista at the moment but come September, the kids will have Windows 8. The main problem is that the kids will not be able to run scripts from the command prompt (for security reasons). If I had an executable that does what your helper program does, I could ask our IT Services department to allow this to run. I will give this a go with VB.NET when I get back to school.

Thanks again.
khanning
Scratcher
34 posts

Scratch 2.0 plug-in for Leap Motion

LeapScratch has been re-written in Java. This brought along a nice speed improvement and allowed me to create native .exe and .app files for Windows and Mac respectively. Now running LeapScratch is easier than ever!

LeapScratch will now remember which hand is Hand #2 as long as it doesn't leave the frame. This is very useful for multiplayer games.

There are download links above for Mac, Windows, and Linux. The Linux version is just a .jar file.

You will need at least Java 1.6 to run LeapScratch. You can download Java for free at http://java.com/download

Last edited by khanning (Aug. 19, 2013 19:09:32)

deivkk
Scratcher
7 posts

Scratch 2.0 plug-in for Leap Motion

Hi khanning

I took you previous version in Python to implement a bridge between sensors in Scratch 1 to Scratch 2

http://scratch.mit.edu/discuss/topic/13983/

Is really the Java version faster?
khanning
Scratcher
34 posts

Scratch 2.0 plug-in for Leap Motion

Hi deivkk,

Very cool project, nice work!

The Java version does appear to run a little bit faster. There isn't really a delay with the Python version, but the Java version seems to track fingers a little smoother. If you decide to re-write your bridge in Java and need any help writing or packaging it just let me know!
deivkk
Scratcher
7 posts

Scratch 2.0 plug-in for Leap Motion

Hi khanning!

Your work is really amazing. Indeed my script is really silly and just uses an extra socket server to do the translation from Scratch 1 to 2. However the magic really happens with the libraries that actually interact with the devices.

I'd like to try the new version of LeapScratch in Java but the links above don't seem to work…
SimpleScratch
Scratcher
100+ posts

Scratch 2.0 plug-in for Leap Motion

Hi Kreg
Very nice work
Could you link me to nXIII info on connecting into Scratch 2.0 that you mentioned in first post please

Simon
jishiha
Scratcher
30 posts

Scratch 2.0 plug-in for Leap Motion

Hi khanning,

This is great plugin. Thank you very much for sharing this. I wrote the instructions of how to setup the plugin in Japanese on my blog. Hope that many Japanese scratchers will enjoy your plugin.

http://blog.champierre.com/1017

Regards,

Last edited by jishiha (Aug. 31, 2013 15:37:37)

jogaye
Scratcher
1 post

Scratch 2.0 plug-in for Leap Motion

Hi khanning,

Thanks, great work!

It worked very well but with the last version (v373) there is an error red light that indicates “Cannot find helper app”

Regards
funker
New to Scratch
100+ posts

Scratch 2.0 plug-in for Leap Motion

Hello knanning!
Could you write a module I for Scratch2 for a serial interface (COM1-10)?
So I can send data to Scratch2 and Scratch2 can send data to me?

Thank you.
Greeting
khanning
Scratcher
34 posts

Scratch 2.0 plug-in for Leap Motion

Scratch 2.0 plug-in for Leap Motion is now available in the Leap Motion Airspace store!
https://airspace.leapmotion.com/apps/scratch-2-0-plug-in-for-leap-motion

The Leap Motion Airspace store is currently only available for Windows and OS X users. Linux users will need to use the .jar in post #1.

Instructions and downloads have been updated in post #1.
GadgetAndyMan
Scratcher
100+ posts

Scratch 2.0 plug-in for Leap Motion

Really looking forward to trying out this plugin Must purchase a Leap Motion really soon!

Latest project updated: X-Y Coordinates Challenge - 14 Jan 2014: Various improvements.

My Likes Studios [ Animation | Art | Education | Games | Simulation | Stories ]
Please take a look and follow any studios that interest you with the projects I am adding.
jenniferannegluck
Scratcher
2 posts

Scratch 2.0 plug-in for Leap Motion

jogaye wrote:

Hi khanning,

Thanks, great work!

It worked very well but with the last version (v373) there is an error red light that indicates “Cannot find helper app”

Regards


I'm getting the same thing. I'm pretty new to scratch… I added the LeapMotion.json file. Is there something else I need to do?

Powered by DjangoBB

Standard | Mobile