Again I am following the Microsoft tutorial, just adding in extra screen grabs to help solidify the process in my mind. For the original tutorial, look here https://docs.microsoft.com/en-us/windows/mixed-reality/develop/unreal/tutorials/unreal-uxt-ch4
Spawning Hand Interaction Actors
I’m not going to tell you about the kinds of hand interactions you can do in Hololens 2 because I’m assuming you know about that already. This is just to tell you how to set them up for Unreal.
Hand interaction with UX elements is done with Hand Interaction Actors, which create and drive the pointers and visuals for near and far interactions.
open the MRPawn Blueprint and go to the Event Graph.
- Drag and release the execution pin from Event BeginPlay to place a new node.
- Select Spawn Actor from Class, click the dropdown next to the Class pin and search for Uxt Hand Interaction Actor.
- From the Right arrow at the top pf the Hand Interaction Actor Box, drag and release to spawn a second Uxt Hand Interaction Actor, this time setting the Hand to Right. When the event begins, a Uxt Hand Interaction Actor will be spawned on each hand.
Your Event Graph should match the following screenshot:
SpawnActor function requires a Transform input to avoid a compiler error, so you’ll use the default values.
Drag and release the pin off one of the Spawn Transform pins to place a new node. Search for the Make Transform node.
Drag the Return Value to the other hand’s Spawn Transform so that both SpawnActor nodes are connected.
Select the down arrow at the bottom of both SpawnActor nodes to reveal the Owner pin. Drag the pin off one of the Owner pins and release to place a new node. Search for self and select the Get a reference to self variable.
Create a link between the Self object reference node and the other Hand Interaction Actor’s Owner pin.
check the Show Near Cursor on Grab Targets box for both Hand Interaction Actors. A cursor should appear on the grab target as your index finger gets close, so you can see where your finger is relative to the target.
Compile, save, and return to the Main window. – I’m not screen grabbing that. You know how to do that by now. But double check that your Event Graph looks the same as this last screen grab.
Create something to interact with
So let’s create some things to interact with. I’ll show you how to make a cube blueprint and then you can make however many objects you like to go in the scene.
Go to the Content Browser >> Add/import >> Blueprint Class
choose Actor. Name the actor InteractiveCube – or whatever name you like.
Double-click InteractiveCube to open it in the Blueprint Editor, select Add Component > Scene and name it Root.
Drag-and-drop Root onto DefaultSceneRoot to replace it.
Click Add Component >Cube
Compile and save your blueprint, then head back to the main window.
Drag InteractiveCube into the viewport
A Manipulator is a component that responds to articulated hand input and can be grabbed, rotated, and translated. Applying the Manipulator’s transform to an Actors transform allows direct Actor manipulation.
Open the InteractiveCube blueprint, click Add Component and search for Uxt Generic Manipulator in the Components panel.
Expand the Generic Manipulator section in the Details panel. You can set one-handed or two-handed manipulation, rotation mode, and smoothing from here. Feel free to select whichever modes you wish, then Compile and Save InteractiveCube.