Migrating to MRTK2: Manipulating Holograms by Grabbing


To be honest, the title of this blog post is a bit weird, because in the Mixed Reality Toolkit 1, the concept of grabbing was unknown, as HoloLens 1 does not support this kind of gestures. But nevertheless, as I am on this quest of documenting all the gems I discover while migrating an existing app to Mixed Reality Toolkit 2, this is one of the things I came across. So, I am shoehorning it in this blog post series — the 8th installment of it already. And the fun thing about this one is that although there is a demo project available, I will be writing no code at all. The whole concept of manipulation by grabbing can be done by simply dragging MRTK2 components on top of a game object. Let’s get started.

‘Far Manipulation’

This is really extremely simple. If I want to make a cube draggable in the ‘classic’ sense — that is, point a cursor to it, pinch, and move my hand, and then the cube follows, all you have to do is add a ManipulationHandler to the cube, with default settings:

And then, you simply point the ‘hand ray’ to it, pinch, and move:

But as you could see, I can only drag it. I can’t move it anymore — or rotate — as my hand comes closer, like at the end of the movie. I fact, I can’t do anything anymore.

Allow Grabbing and Moving

For that, we will need to add another script: Near Interaction Grabbable.

And now, if the hand comes close to the cube, you can do all kinds of crazy stuff with it.

Some Settings to Consider

  • If you don’t want to allow ‘far manipulation’ (the first type) but only want to allow the manipulation by gripping, you can uncheck the “Allow Far Manipulation” on the ManipulationHandler.
  • If you want to see where the actual grab connection point is, check the “Show Tether When Manipulating” checkbox on Near Interaction Grabbable. This will look like this:

I bet there are more settings to consider, but I haven’t tried those yet (or felt the need to do so).


The code of this completely code-less sample can be found here. I can’t wait to add code like this to real-world HoloLens 2 projects. But alas, we still need to wait for the device.

This UrIoTNews article is syndicated fromDzone