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

Set Up Cameras for Gear VR

Choose your OS:
Prerequisite Topics

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

Hero_Image.png

No matter if your Gear VR project is a sitting or standing experience, the manner in which the user's camera is set up will be the same. In the following How - To we will go over how to set up a UE4 camera for use with the Gear VR HMD.

Steps

Below you will find instructions on project setup requirements as well as how to create the needed Pawn Blueprints for Gear VR.

  1. First, create a new UE4 project with the following settings and once the setting has been input, press the Create Project button to create the project.

    • Blueprint

    • Blank Project

    • Mobile / Tablet

    • Scalable 3D or 2D

    • No Starter Content

    • Location for the project to be saved

    • Name for the project

    Click for full image.

  2. Once the project loads, right-click in the Content Browser and from the displayed menu, go to the Create Basic Asset section and select the Blueprint Class option.

    Click for full image.

  3. From the Pick Parent Class window, select the Pawn option and then give it a name of GearVR_Pawn.

    Click for full image.

  4. Open up the GearVR_Pawn Blueprint and go to the Component section of the Viewport tab. Using the Add Component button add the following two components with the following names and also make sure that the VRCamera is a child of the VRCameraRoot.

    • Scene - VRCameraRoot

    • Camera - VRCamera

    HT_GearVR_Camera_Setup_02.png

    No matter what VR HMD you are using, this is the Epic recommend way to set up a VR camera as it allows you to offset the position of the camera without having to move the actual camera.

  5. Now open up the GearVR_Pawn Blueprint and in the Event Graph drag off the Event Begin Play node to show the Executable Actions list and search for the Set Tracking Origin node, clicking on it to add it to the Event Graph.

    Click for full image.

  6. Make sure the Origin of the Set Tracking Origin node is set to Eye Level.

    Click for full image.

  7. In the Blueprint editor under the Variables section, create a new Vector variable called CameraHeight and set the Z value to 180.

    HT_GearVR_Camera_Setup_03.png

    This number set in CameraHeight should be set to the real world standing height of the user in Centimeters.

  8. Drag off the output of the Set Tracking Origin node and search for the Set Relative Location node, selecting the SetRelativeLocation(VRCameraRoot) option.

    Click for full image.

  9. Connect the CameraHeight variable to the New Location input on the Set Relative Location node and then press the Compile button. When completed your Event Graph should look like the following image.

    Copy Node Graph

    You can copy the completed Blueprint by clicking on the upper left-hand corner of above and pressing CRTL + C to copy the graph. Once copied, go to your Blueprints event and press CTRL + V to paste it in.

  10. Drag the GearVR_Pawn Blueprint from the Content Browser to a level, making sure that it is placed as close to the ground as possible.

    Click for full image.

  11. Select the GearVR_Pawn Blueprint and in the Details panel under the Pawn setting, set the Auto Possess Player from Disabled to Player 0.

    Click for full image.

  12. Finally, go to the Main Toolbar and click on the small white triangle next to Launch Options and then select your Android device from the list to start the packaging and deployment to that device.

    HT_GearVR_Camera_Setup_08.png

End Result

Once the UE4 project has deployed, put your Smartphone into your Gear VR HMD and when you move your head around it should look like 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