Scratch Leap Motion Extension

Contents

Quick Start

To use the extension, plug in your Leap Motion controller and open the Leap Motion extension on ScratchX.org.

Introduction

This Scratch extension lets you incorporate hand tracking into your projects using the Leap Motion controller. For example, you can control a character on the screen by moving your hands around.


Example project showing hand and finger tracking using the Leap Motion controller.

Equipment

You will need access to a Leap Motion controller

Getting Started

  1. If you haven't already done so, follow the setup instructions for installing the Leap Motion software.
  2. Connect the Leap Motion controller to your computer's USB port
  3. Load the Leap Motion extension on ScratchX.

Hands

The extension is capable of tracking up to two hands at a time. The hands are referred to as either 'hand A' or 'hand B'.

The first hand to become visible to the Leap Motion controller is referred to as 'hand A'. It doesn't matter if this is your right or left hand.

If a second hand becomes visible it will be referred to as 'hand B'.

Fingers

The extension is capable of tracking up to ten fingers at a time. Fingers are always assigned to either 'hand A' or 'hand B'. See the Hands section above for details about the hand naming convention.

Each finger is numbered 1 - 5:

Tools

The extension is capable of tracking up to two tools at a time. A tool is a long straight object like a pencil or a chopstick.

Tools are referred to the same way as hands. They are called either 'tool A' or 'tool B'.

The first tool to become visible to the Leap Motion controller is referred to as 'tool A'.

If a second tool becomes visible it will be referred to as 'tool B'.

Gestures

The extension can also detect certain gestures you can make with your hand and fingers. Supported gestures are:

Tap - Downward tapping motion with a finger

Poke - Forward tapping motion with a finger

Swipe - Moving hand with fingers extended in a straight line across the screen

Circle - Making a circular movement with a finger

Scratch Blocks

This is a brief description of each of the Scratch blocks included with the Leap Motion extension.


Returns the current X position of a hand.


Returns the current Y position of a hand.


Returns the current Z position of a hand.


Returns the current rotation of a hand.


Checks if a hand is visible.


Checks if a hand is closed.


Returns the current X position of a finger.


Returns the current Y position of a finger.


Returns the current Z position of a finger.


Checks if a finger is extended.


Returns the current X position of a tool.


Returns the current Y position of a tool.


Returns the current Z position of a tool.


Checks if a tool is visible.


Runs when a gesture is detected.


Waits until a gesture is detected.

Example Projects

Hand Skeleton
Example of hand and finger tracking to draw a hand skeleton on the screen.

Spinning Wheel
Example of using gestures to start and stop a spinning prize wheel.