#Hololens – Detect user hand interactions using #HoloToolkit (update!)


During the last few months HoloToolkit has changed a lot. These changes make some of the examples that I have written as non-valid posts. In today’s post, I’ll quickly explain how to implement detection of hands with the current version of HoloToolkit.

We start with the basics with these steps


  1. Create a 3D project in Unity3D
  2. Configure project to support HoloLens projects
  3. Clean Scene elements
  4. Import HoloToolkit package
  5. Add
    1. HololensCamera
    2. SpatialMapping
    3. CursorWithFeedback
  6. Add Empty element, Managers
    1. Add existing scripts
      1. Gaze Managers
      2. Gaze Stabilizer
      3. Input Manager
  7. Add Empty element, HoloCollection
    1. Add 3D elements
      1. Cube
        1. Position, x:0 y:0 z:2
        2. Rotation, x:0 y:0 z:0
        3. Scale, x:0.3 y:0.3 z:0.3
      2. AnchorText (from HoloToolkit)
        1. Position, x:0 y:0.35 z:2
        2. Rotation, x:0 y:0 z:0
        3. Scale, x:0.3 y:0.3 z:0.3
  8. Into the Manager collection
    1. Add script Text Debug Manager (later on the post)
      1. Drag the Anchor Text (7.1.2) into the Anchor Debug Text Property

This is the process creating a basic Hololens project. Now let’s create a script that detects any of the user actions with his hands. This script will display these actions in the AnchorText which I have added to the collection of holograms in debug mode.

For this example, I will call the script “TextDebugManager.cs“. The same code is as follows


using HoloToolkit.Unity.InputModule;
using UnityEngine;

public class TextDebugManager : MonoBehaviour, IHoldHandler, IInputHandler

 public TextMesh AnchorDebugText;
 private string _debugTextHold = "";
 private string _debugTextInput = "";
 void Update()

 private void UpdateText()
   if (AnchorDebugText != null)
     AnchorDebugText.text = string.Format(
       "Hold: {0}\nInput: {1}", _debugTextHold, _debugTextInput);

 public void OnHoldStarted(HoldEventData eventData)
   _debugTextHold = "OnHoldStarted";

 public void OnHoldCompleted(HoldEventData eventData)
   _debugTextHold = "OnHoldCompleted";

 public void OnHoldCanceled(HoldEventData eventData)
   _debugTextHold = "OnHoldCanceled";

 public void OnInputUp(InputEventData eventData)
   _debugTextInput = "OnInputUp";

 public void OnInputDown(InputEventData eventData)
   _debugTextInput = "OnInputDown";

Within the class I implemented interfaces “IHoldHandle” and “IInputHandler“. Then be shown the operations be interfaces in the Update() of the script. In this way, we can implement a model of Debug PPP of Hololens in a quick way, and in this case, to capture the interactions of the user about the holograms.

Greetings @ TorontoEl Bruno



  1. Bruno, I dont know where else to go, i got a problemwith a hololens problem i want to develop for myself, it is quite simple i bassically just want to be able to drag a cilinder with my hand using the hand draggable script, i had used it before on unity 5.5, but somehow it doesnt work anymore on unity 2017 and there is nothing on the web about this, is there something im not seeing?


      1. Thanks!! actually i was able to fix it trying something like that. 2017.2 is still not completely compatible with hololens, using 2017.1 works great.
        Big fan btw


Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: