Language:
Page Info
Tags:
Skill Level:
Engine Version:

Use the Gear VR Touchpad

Choose your OS:
Prerequisite Topics

This page assumes you have prior knowledge of the following topics. Please read them before proceeding.

HTGVRMCTouchpad_Here_Image.png

Due to the highly precise nature of the Gear VR Motion Controller (MC) Touchpad, it can be used to perform all kinds of different interactions that require high precision. From scrolling through a series of menu options or trying to plot your precise location on a map, there is an almost endless amount of ways to use the Touchpad to interact with the virtual world. In the following How - To we will take a look at how to get and then display the current location that is being touched on the Gear VR Motion Controller Touchpad.

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

Below you will find information on how to setup your GearVR Motoin Controller Touchpad to display the location the user is touch it.

  1. First, open up your player Pawn Blueprint and from the Component tab, add two new Text Render component, called X_Position and Y_Position. Make sure that both are parented to the Motion Controller component like in the image below.

    HTGVRMCTouchpad_00.png

  2. Click on the Text Component and then in the Details panel set the following properties with the following values for both the X and Y text.

    Click for full image. Note that this is only showing the Y_Position properties. See table below for X_Position properties.

    Property Name

    Value

    Location X Text

    X = 20, Y = 0, Z = 0

    Location Y Text

    X = 20, Y = 0, Z = 5

    Rotation X & Y

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

    Horizontal Alignment X & Y

    Center

    Vertical Alignment X & Y

    Text Center

    World Size X & Y

    5

  3. Before we can build the logic for the Blueprint, we first need to create two variables to hold and display the X and Y input location on the Touchpad. Go to the Variables section, add two new Text Variables called XPositionText and YPositionText.

    HTGVRMCTouchpad_02.png

  4. To display the current location that is being pressed on the Touchpad, we will first need to get and then store the X and Y Axis Value of the current touch input. Then, using the Set Text node we can display that information via the Text Render Component that we added to our Gear VR Motion Controller. To do this in our Blueprint first, add the following nodes and variables to the Event Graph.

    Click for full image.

    Node / Variable Name

    Value

    MotionController(R)Thumbstick X

    N/A

    ToText(Float)

    N/A

    SET_ XPosition_Text(Float)

    N/A

    Set Text

    N/A

    X_Positiont

    N/A

    XPositionText

    N/A

    Append

    A Input: X:

    ToText(string)

    N/A

  5. Next, we need to build the logic that will display the input location using the text that was attached to the Motion Controller. To do this, we will need to first get the Axis Value of the MotionController (R)Thumbstick X and store that in the XPositionText variable. Once we have that information, we can then display this value using the X_Postion text. When completed, your Blueprint should look like the following image.

    Copy Node Graph

    Click image to copy Blueprint code.

  6. Now that we have the X-axis input value, to get the Y axis input value, we can use the same logic, we just need to change the MotionController(R)Thumbstick and variables to use the Y axis. When completed your entire Blueprint should look like the following image.

    Copy Node Graph

    Click image to copy Blueprint code.

End Result

Once the Blueprint has been compiled and saved, deploy the project to your smartphone, and pick up your GearVR HMD and Motion Controller. Now, when you touch the Touchpad, you should see the numbers update with the location that you are currently touching 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.

Tags