Yeshwanth Pulijala
5 min readMay 14, 2016

--

How can you integrate Hand based menu into your project:

Note: This is only a guideline,

Sources: 1. https://github.com/aestheticinteractive/Hover-VR-Interface-Kit/wiki/Getting-Started

and my own notes..

So get ready:

  1. Install Leap Motion Orion plug in into Unity
  2. Install Oculus OVR plug in into Unity
  3. Install Hover VR Orion plug in into Unity
  4. Make few changes to the scripts, especially to do with

using UnityEngine;
using System.Collections.Generic;
using Leap;
using Leap.Unity;

In transform function, for Rotation, use

transform.rotation = _hand.Basis.rotation.ToQuaternion();

Because “The rotation member is a property, so no parentheses. Also, since the rotation property is a Leap API class, you also have to convert it to a Unity Quaternion to assign it to a Unity rotation.

transform.rotation = _hand.Basis.rotation.ToQuaternion();

Note that the lower case of rotation is counter to our style guide for C# code, so we will probably change it to upper case and deprecate the lower case version at some point.”

Source of this correction is here: https://community.leapmotion.com/t/trouble-accessing-lm-api-resources-in-unity/4774/14

5. This should now not show any errors in the scene

6. Setting up the Leap Motion Orion hand controller:

  1. Once you’ve set up the Core Assets (see above), go to LeapMotion/Prefabs in theAsset window.
  2. From LeapMotion/Prefabs, drag a LMHeadMountedRig into your scene.
  3. In the hierachy for the LMHeadMountedRig, you see a LeapHandController.
  4. From the LeapMotion/Prefabs/HandModelsNonhuman folder, drag a CapsuleHand_L and a CapsuleHand_R to your scene hierarchy window and make them children of the LeapHandController.
  5. From the LeapMotion/Prefabs/HandModelsPhysical folder, drag a RigidRoundHand_L and a RigidRoundHand_R to your scene hierarchy window and make them children of the LeapHandController.
  6. Locate the HandPool component attached to the LeapHandController. Set the Model Collection value to 4. Then move your two graphics hands and two physics hands from the Hierarchy view to the four empty slots.
  7. On the LeapHandController GameObject you’ll see a LeapProvider component. For VR, make sure that “Is Head Mounted” is enabled.
  8. Be sure to enable VR support in Edit/Project Settings/PlayerSettings/OtherSettings/ Virtual Reality Supported.
  9. Video passthrough can be toggled by enabling or disabling the QuadBackground GameObject’s transform in the Inspector.
  10. You can then add a directional light (from the Create menu on the upper left) to illuminate the hands.
  11. You can also add objects into the scene and put them near the controller. To interact with the objects, click on the Cube, then Add Component, and add Rigidbody. Be sure to disable gravity so that the object doesn’t fall away (you’ll see this in the Rigidbody properties.)

7. Now set up Hover Cursor first:

Input Modules

Use the steps for only one of the input modules below.

Leap

  1. Add/configure the Leap Motion HandController Prefab.
  2. Attach the HovercursorLeapInput script to it.
  3. Create an empty GameObject named Hovercursor as a child of HandController.
  4. Attach the HovercursorSetup script to it.

Look

  1. Create an empty GameObject named Hovercursor.
  2. Attach the HovercursorSetup script to it.
  3. Attach the HovercursorLookInput script to it.
  4. Select a GameObject for the “Headset Camera Transform” property.

Optional Steps

  • Find Hovercursor.
  • Attach the HovercursorVisualSettingsStandard script to it.
  • Adjust the various properties.
  • Find Hovercursor’s HovercursorSetup script.
  • Select a Transform for the “Camera Transform” property.
  • Select a specific HovercursorVisualSettings instance for the “Default Visual Settings” property.
  • Select a specific HovercursorInput instance for the “Input” property.

Technical Notes (This is not necessary, but have a look)

  • HovercursorSetup obtains its “Default Visual Settings” using the following priorities:
  1. Use the script specified in the “Default Visual Settings” property.
  2. Use the first HovercursorVisualSettings-based script found in the scene.
  3. Create, attach, and use the default HovercursorVisualSettingsStandard script
  • HovercursorSetup obtains its “Input” using the following priorities:
  1. Use the script specified in the “Input” property.
  2. Use the first HovercursorInput-based script found in the scene.
  3. Throw an exception.
  • HovercursorSetup uses the “Camera Transform” property to ensure that the cursor elements always face toward the desired object. This object should either represent the camera itself, or the center of two VR cameras.
  • HovercursorLookInput uses the “Headset Camera Transform” property to fire a ray (relative to this transform) the Vector3.forward direction. The “Look” cursor appears at the intersection of this ray and the nearest interaction plane.
  • It is possible to display cursors without a Hovercast or Hoverboard element in the scene. To do this, create a custom IHovercursorDelegate implementation, and send that delegate toHovercursorState.

8. Hover Cast Integration:

Items

  1. Create an empty GameObject named HovercastMenu.
  2. Attach the HovercastItemHierarchy script to it.
  3. Create empty GameObjects, each representing a menu item, as children of HovercastMenu(or as children of other menu items).
  4. Attach the HovercastItem script to each.
  5. Enter a short string for the “Label” property.
  6. Select the desired option for the “Item Type” property.
  7. Adjust the other properties. Some properties are only available for specific item types.

Input Modules

Note: Hovercast and Hovercursor may use different input modules.

Leap

  1. Add/configure the Leap Motion HandController Prefab.
  2. Attach the HovercastLeapInput script to it.
  3. If head-mounted, set the “Active Palm Direction” property to [0, -1, 0].
  4. If table-mounted, set the “Active Palm Direction” property to [0, -0.5, -1].
  5. Create an empty GameObject named Hovercast as a child of HandController.
  6. Attach the HovercastSetup script to it.

Optional Steps

  • Find Hovercast.
  • Attach the HovercastItemVisualSettingsStandard script to it.
  • Adjust the various properties.
  • Attach the HovercastInteractionSettings script to it.
  • Adjust the various properties.
  • Find Hovercast’s HovercastSetup script.
  • Select a specific HovercastItemHierarchy instance for the “Item Hierarchy” property.
  • Select a specific HovercursorSetup instance for the “Hovercursor” property.
  • Select a specific HovercastItemVisualSettings instance for the “Default Item Visual Settings” property.
  • Select a specific HovercastInteractionSettings instance for the “Interaction Settings” property.
  • Select a specific HovercastInput instance for the “Input” property.
  • Find any menu item GameObject (one with an attached HovercastItem script).
  • Attach the HovercastItemVisualSettingsStandard script to it.
  • Adjust the various properties.
  • Attach a custom-written, HovercastItemVisualSettings-based script to it (instead of the previous step).
  • Adjust any properties that it might have.
  • Attach a custom-written, HovercastItemListener-based script to it.
  • Adjust any properties that it might have.

Technical Notes (Not totally required)

  • HovercastSetup obtains its “Item Hierarchy” using the following priorities:
  • Use the script specified in the “Item Hierarchy” property.
  • Use the first HovercastItemHierarchy-based script found in the scene.
  • Throw an exception.
  • HovercastSetup obtains its “Hovercursor” using the following priorities:
  • Use the script specified in the “Hovercursor” property.
  • Use the first HovercursorSetup-based script found in the scene.
  • Throw an exception.
  • HovercastSetup obtains its “Default Item Visual Settings” using the following priorities:
  • Use the script specified in the “Default Item Visual Settings” property.
  • Create, attach, and use the default HovercastItemVisualSettingsStandard script.
  • HovercastSetup obtains its “Interaction Settings” using the following priorities:
  • Use the script specified in the “Interaction Settings” property.
  • Use the first HovercastInteractionSettings-based script found in the scene.
  • Create, attach, and use the default HovercastInteractionSettings script.
  • HovercastSetup obtains its “Input” using the following priorities:
  • Use the script specified in the “Input” property
  • Use the first HovercastInput-based script found in the scene.
  • Throw an exception.
  • A GameObject that represents a menu item (which has an HovercastItem script attached) can also have:
  • One HovercastItemVisualSettings-based script attached, which changes only that item’s visual settings.
  • One or more HovercastItemListener-based scripts attached, which allow for custom handling of that item’s events.

9. This should now work with your scene.

--

--

Yeshwanth Pulijala

Founder of Scalpel Ltd. Builds tech to make surgery safer. Ph.D. in Mixed reality applications for Surgery. Also a Dentist.