Mini Leap Motion Input-SDK for Unity

During my studies of Computer science of media I worked on several small demos that are using the Leap Motion as an input device. I liked the idea of controlling you game with your hands and create some prototypes with different control schemes for the Leap Motion. Quickly I noticed that the technology wasn’t completely flesh out yet and the finger detection (at that time) has been too inaccurate to really play games with it. I still wanted to use the Leap Motion and was trying to create a “highlevel” Input-SDK for the device that ignores the fingers and focuses only on the hand.

The outcome has been a set of Leap Motion prefabs that can be directly used for certain control types. The following screens show the demo application I created for each of these “Input-Scheme-Prefabs”.

Implemented input schemes: the Balancer, the Gyroscope, the DPad/Analog stick, “Hand is Leaving-Warning”.

The Balancer

The balancer uses two hands and calculates the angle between the users hands. This value can be used to control the steering-wheel of a car ingame, for example. The created demo is using the “Balancer”-Prefab to control a seesaw with a ball placed on it by rotating it around the Z-axis. The ball has a rigidbody and is therefor moving on the seesaw. Every X seconds a cube is spawned that can be collected by the rolling ball.

 

The Gyroscope

This input scheme uses only one hand and detects the hands XYZ-angles. The values are normalized and can be used to control the rotation of an object. Perhaps the rotation of a spaceship flying in an 3D environment. For the demonstration scene I created a labyrinth with two balls that must reach the randomly positioned cube. The labyrinth can be rotated with the users hand to make the balls roll to their destination.

The Dpad/Analog Stick

In most cases an analog stick is used to move the players avatar through the virtual worlds. The idea of an “analog stick”-like control scheme for the Leap Motion was to move your hands on the XYZ-axis and use the delta-values of the users hand to determine the direction. To get delta-values you first have to determin the “zero position”. This is done as soon as the Leap Motion detects a new hand. The Mini-SDK then keeps tracking the hand position for a short period of time hand uses the mean value as the default-position of the hand.

To demonstrate the usage this input scheme I created a scene were the user can move around in an environment with different obstacles. It is possible to run fast or slow depending on how much the users hand is moved. It is also possible to duck and jump moving the hand up and down. The avatars animations adjust to the speed of it’s character.

The “Hand-Is-Leaving-Warning”

Since the user might not notice the he is close to leave the detection area of the Leap Motion I decided to implement another Prefab that shows warnings at the screen borders if the users hand is about to be outside of the devices range.