Skip to content
LeapMotionInputForMRTK simulates hand inputs for MRTK with Leap Motion
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Assets update MRTK from RC1 to RC2.1 Jun 18, 2019
External update MRTK from RC1 to RC2.1 Jun 18, 2019
Packages
ProjectSettings first commit May 24, 2019
.gitignore first commit May 24, 2019
.gitmodules
License.txt first commit May 24, 2019
README.md Update MRTK version Jun 18, 2019

README.md

LeapMotionInputForMRTK

LeapMotionInputForMRTK simulates hand inputs for MRTK with Leap Motion.

Demo video

Demo video

Prerequisites

Getting Started

1.A. Clone this repository

> git clone git@github.com:HoloLabInc/LeapMotionInputForMRTK.git --recursive
> cd LeapMotionInputForMRTK
> External\createSymlink.bat

Open LeapMotionInputForMRTK project with Unity 2018.3.x.

1.B. Import unitypackage

Create project with Unity 2018.3.x.

Import MRTK v2

Download and import MRTK v2 unitypackages.
(https://github.com/microsoft/MixedRealityToolkit-Unity/releases/tag/v2.0.0-RC2.1)

  • Microsoft.MixedReality.Toolkit.Unity.Examples-v2.0.0-RC2.1.unitypackage
  • Microsoft.MixedReality.Toolkit.Unity.Foundation-v2.0.0-RC2.1.unitypackage

Import LeapMotionInputForMRTK

Download and import the latest LeapMotionInputForMRTK unitypackage.
(https://github.com/HoloLabInc/LeapMotionInputForMRTK/releases)

2. Import Leap Motion Core Assets

Download "Unity Core Assets" and import to the unity project.
(https://developer.leapmotion.com/unity/#5436356)

3.A. Open sample scene

Open Assets/LeapMotionInputSimulation/Scenes/SampleScene.

3.B. Create new scene

When creating new scene, MRTK settings window pops up.
Drag and drop Assets\LeapMotionInputSimulation\LeapMotionMixedRealityToolkitConfigurationProfile.asset to the window and press "Yes".

SceneSetting

After the scene is loaded, select "Main Camera" in Hirerarchy and add LeapXRServiceProvider component.

LeapXRServiceProvider

Enable Hand Mesh

If you want to enable Hand Mesh, attach HandModelManager script to "Main Camera".
Edit the component like the following picture.
LoPoly Rigged Hand prefabs are in Assets\LeapMotion\Core\Prefabs\HandModelsNonHuman folder.

HandModelmanager

4. Fix MRTK v2

There is a bug in MRTK v2.
(https://github.com/microsoft/MixedRealityToolkit-Unity/issues/4607)

To fix the bug, edit Assets\MixedRealityToolkit\Providers\Hands\BaseHandVisualizer.cs.

l.147-

if (handMeshFilter != null)
{
    Mesh mesh = handMeshFilter.mesh;

    if((mesh.vertices?.Length ?? 0) != 0 && 
        mesh.vertices?.Length != eventData.InputData.vertices?.Length)
    {
        mesh.Clear();
    }
    mesh.vertices = eventData.InputData.vertices;
    mesh.normals = eventData.InputData.normals;
    mesh.triangles = eventData.InputData.triangles;

    if (eventData.InputData.uvs != null && eventData.InputData.uvs.Length > 0)
    {
        mesh.uv = eventData.InputData.uvs;
    }

    mesh.RecalculateBounds();

    handMeshFilter.transform.position = eventData.InputData.position;
    handMeshFilter.transform.rotation = eventData.InputData.rotation;
}

5. Switch platform

In the Build Settings window, switch platform to Universal Windows Platform.

6. Mount Leap Motion on HoloLens (1st gen)

Mount Leap Motion on HoloLens like the following picture.
3D Printable Models

MountedLeapMotion_small

Adjust the offset and tilt values.

image

7. Play in Unity Editor

On your HoloLens, start the Holographic Remoting Player app.

In Unity, select "Window > XR > Holographic Emulation".
Enter the IP address of your HoloLens and press Connect button.

HolographicRemoting

Press Play button in Unity Editor.

Author

Furuta, Yusuke (@tarukosu)

License

MIT

You can’t perform that action at this time.