Introduction
Lemonity is a Unity Editor extension that allows you to navigate around the scene using your hands. A Leap Motion device is required for hand tracking.
Available at the official Unity Asset Store: https://assetstore.unity.com/packages/slug/161187
Requirements
- Leap Motion device in desktop mode
- One or more hands
- Windows 10 x64
- Scripting Runtime Version .NET 4.6 or above
Installation
• Lemonity requires the Leap Motion Orion V4 service to be installed. You can download it for free here: https://developer.leapmotion.com/setup/desktop
• Import Lemonity package to your Unity project.
• Lemonity includes LeapMotion Unity Core Assets 4.4.0. If you already have this package added to your project, you should avoid importing it by unselecting “LeapMotion” folder. Alternatively, you can remove the folder from the project after importing (it will be in Assets/Lemonity/LeapMotion).
First Steps
- Open Lemonity options window using Unity menu “Window/Lemonity Options”
- Choose a working mode in the Lemonity Options window
- Optionally open Lemonity Debug window “Window/Lemonity Debug” to see more information.
- You are ready to start working with Lemonity.
Gestures
Only two gestures are used in Lemonity:
Grab Gesture
Close all the fingers
Pinch Gesture
Join thumb and index fingertips
Gesture limits and hysteresis can be adjusted in the Options dialog.
Grab Mode
This working mode allows you to move and rotate the scene by grabbing it using the Grab Gesture. You can use one or two hands.
One Hand
Two Hands
Setting the scale
The range of motion of your hands depends on the Scene Scale parameter. As the scale increases, the sensitivity and precision are decreased. It’s convenient to enable Show Workspace (Visual Effects) to have an idea of the current range of motion.
- Option 1. Change the scale using the UI.
- Option 2. Change the scale using Pinch Gesture with both hands.
Rotation Factor
The rotation factor is a multiplier of the hand rotation. It allows you to perform rotations with less effort.
- Rotation factor 1x
- Rotation factor 2x
Orbit Mode
This mode allows you to orbit the camera around the selected object.
Rotate/Zoom feature
The grab gesture controls the orbit:
- Left/Right: Rotate around Y axis (yaw)
- Top/Bottom: Rotate around X axis (pitch)
- Forward/Backward: Zoom
Center/Align feature
Pinch gesture aligns the camera to the selected object:
- Simple pinch: Center view to selected object
- Pinch and move following an orthogonal axis: align view to axis
Fly Mode
Fly around the scene using one or two hands. Do the grab gesture to navigate.
One hand
Move
Rotate
Two hands
Move
Rotate
Hover Mode
A special flight mode where the height to the floor is fixed.
Options
Gesture Thresholds
Gestures are triggered using hysteresis to improve stability. This means that they use a different threshold for detecting when a gesture starts and when it stops.
Grab gesture is detected using Leap Motion’s GrabStrength parameter, which ranges from 0 when the hand is fully open, and 1 when all the fingers are closed.
Start Threshold: If GrabStrength is higher than this parameter then the gesture is triggered.
Stop Threshold: If GrabStrength is lower than this parameter then the gesture is released.
Pinch gesture is detected using the distance (in millimetres) from Index and Thumb fingertips. It ranges from a close value near zero when both fingers are touching, to more than 50 when the hand is open.
Start Distance: If the distance is lower than this parameter then the gesture is triggered.
Stop Distance: If the distance is higher than this parameter then the gesture is released.
Tracking Filtering
Lemonity implements a motion filter to smooth the noise from the tracking. It filters Rotation and Position of the hands in space. The more aggressive the filter is, the smoother the movements will be at the cost of slow response.
Minimum Cut Off Frequency: Decrease it to decrease slow speed jitter
Beta Speed Coefficient: Increase the speed coefficient to decrease speed lag.
Cut Off for derivative: Used to smooth the speed calculation, defaults to 1.
Involuntary Gestures
Sometimes it is possible that a gesture is triggered involuntarily, especially when one of your hands moves near the Leap Motion workspace. This heuristic ignores the gestures that:
- Start outside of a defined safe zone (adjusted with the parameter Safe Zone Radius). This zone is showed in the Lemonity Debug Window.
- Move in outward direction.
The Lemonity Debug Window lets you know if a gesture is being filtered.
Frequently Asked Questions (FAQ)
After adding the Lemonity package to Unity, it doesn’t work
- Probably Unity hasn’t loaded the Leap Motion DLL yet. Please restart Unity.
- Lemonity requires the Leap Motion Orion service to be installed. You can download it for free here: https://developer.leapmotion.com/get-started. Install it and then restart Unity.
- Open Leap Motion control panel and check it is working using their Diagnostic Visualizer (Troubleshouting tab).
- Open Lemonity Options Window (Alt+L or go to menu Window/Lemonity Options) and select a working mode (Grab/Orbit/Fly).
- Open Lemonity Debug Window (menu Window/Lemonity Debug) and check that Leap Motion is connected and that hands are detected if moved above Leap Motion.
Lemonity does not remember the selected options after restarting Unity.
Click the Save button on the bottom of the Lemonity Options window after you find a configuration you like.
Gestures are not reliable enough. How can I improve them?
- Open Lemonity Options Window and adjust thresholds in section Gesture Thresholds. You can test and fine tune them using the Lemonity Debug Window.
- Check that your gestures are not being ignored by the Involuntary Gestures Heuristic (see Involuntary Gestures). Increase the safe zone radius or disable the heuristic.
Sometimes a gesture is triggered involuntarily.
- Enable the Involuntary Gestures heuristic and/or decrease the safe zone radius (see Involuntary Gestures).
I get the error CS1644 "Feature X cannot be used because it is not part of the C# 4.0 language specification
Go to Edit > Project Settings > Player > Other Settings. Set Scripting Runtime Version .NET 4.x