The Gear VR Motion Controller(MC) has some different buttons and a touchpad that can be setup to handle a wide variety of different input tasks in UE4. In the following How - To we will take a look at how to setup and use the touchpad and the five different buttons that it offers.

In this How - To we will be starting with a Pawn that already has a VR Camera and Motion Controller support added to it. If you do not have this setup, please check out the documents listed in the Prerequisite Topics list at the top of this page.

Steps

First, open up your Player Pawn Blueprint and from the Component tab, add a new Text Render component, called FaceButtonPressed and make sure that it is parented to the Motion Controller component like in the image below.

Click on the Text Component and then in the Details panel set the following properties with the following values.

Click for full image.

Property Name

Value

Location

X = 20, Y = 0, Z = 0

Rotation

X = 0, Y = 0, Z = -180

Horizontal Alignment

Center

Vertical Alignment

Text Center

World Size

13.0

Next, we need to create a new Text variable that will store and display what button is currently being pressed on the Motion Controller touchpad. To accomplish this go to the Variables list and create a new Text variable called ButtonText.

The GearVR Motion Controller touchpad has five buttons that can be used. Four of the five buttons are activated by pressing in one of the four cardinal directions ( North South East and West) on the touchpad. The fifth button is triggered when a user touches the surface of the touchpad. To set this up in our Blueprint, add the following five Motion Controller (R) FaceButton Event nodes to the Event Graph.

Click for full image.

Node Name

Default Value

Motion Controller (R) FaceButton1

N/A

Motion Controller (R) FaceButton2

N/A

Motion Controller (R) FaceButton3

N/A

Motion Controller (R) FaceButton4

N/A

Motion Controller (R) FaceButton6

N/A

Now we are going to setup the logic for displaying which button on the touchpad was pressed. To accomplish this, first, drag the ButtonText variable into the Event Graph and choose the Set option as we want to set the text that is displayed.

Click for full image.

Connect the Pressed output on the Motion Controller (R) FaceButton1 Event node to the input on the Set Button Text node and then in the Button Text input the following text.

Face Button 1

Click for full image.

If we pressed the Motion Controller Face Button 1 now, nothing would happen as we have the only setup the ability to input the text we want to display. To display the text, you will first need to right-click in the Event Graph and then search for the Set Text node as this will set the text to what we input in the Set Button Text variable. When searching for the Set Text node, make sure to select the SetText(FaceButtonPressed) option so that it will automatically add a reference to the Face Button Pressed text to render the component.

Click for full image.

Next, we need to connect the Set Button Text node to the Set Text node so that the text input in the Set Button Text node will be displayed when the touchpad button is pressed. To accomplish this, connect both outputs on the Set Button Text node to the available inputs on the Set Text node and when completed your Blueprint should look like the following.

Click for full image.

Repeat this process for the remaining button directions. When doing this, make sure to change the text input into the Set Face Button Text to reflect the button that is being pressed. When completed with this your Blueprint should look like the following image.

Finally, we need to attach the text that tells us which Motion Controller is pressed to the Motion Controller so that when the Motion Controller is moved, the text will move along with it. To get this working first add the following nodes to the Event Graph:

Node Name

Default Value

GearVRController

N/A

FaceButtonPressed

N/A

Get Motion Controller

N/A

AttachToComponent

N/A

Once the nodes have been added, connect the AttachToComponent node to the output of the SetRelativeLocation node. Then connect the FaceButtonPressed to the Target input on the AttachToComponent node. Finally, connect the GearVRController to the GetMotionController node and connect the output of that into the Parent input on the AttachToComponent node and when completed this part of your Blueprint should look like the following image.

End Result

Compile and save your Blueprint and then use the Launch On button to deploy and launch the project to your Samsung Galaxy Note smartphone. When the project is deployed to your phone, put your phone in the Gear VR HMD and pick up the Motion Controller. Now when you press in any of the cardinal directions on the touchpad, the button you pressed should be displayed like in the following video.

UE4 Project Downloads

Below you will find a link to where you can download the UE4 project that was used to create this example.