Set Up Cameras for GoogleVR

Setting up the Camera to work with GoogleVR.

Choose your operating system:

Windows

macOS

Linux

Prerequisite Topics

In order to understand and use the content on this page, make sure you are familiar with the following topics:

VR_Seated_Experiance.png

Regardless of whether your GoogleVR project is a sitting or standing experience, the manner in which the game's Camera is set up will be the same. In the following How-To, we will go over how to set up the Camera for use with GoogleVR experiences.

Steps

Below, you will find instructions on project and camera setup requirements for a GoogleVR experience.

  1. First, create a new Unreal Engine project from the Games > Blank template, with the following settings:

    • Blueprint enabled

    • Mobile / Tablet enabled

    • Scalable 3D or 2D enabled

    • No Starter Content enabled

    • Folder for the project

    • Name for the project

  2. In the Editor, open up the Plugins menu by going to Edit > Plugins .

    HT_GoogleVR_Camera_Setup_01.png

  3. Inside the Plugins window, select the Virtual Reality section and then enable the GoogleVR option by clicking on the Enabled check mark box.

    Click for full image.

    You will need to restart the Editor once you have enabled the plugin so that it will be loaded on the next Editor launch.

  4. After the Editor has restarted, Right-click in the Content Browser and from the displayed menu, go to the Create Basic Asset section and select the Blueprint Class option.

    HT_Rift_Camera_Setup_01.png

  5. From the Pick Parent Class window, select the Pawn option, giving it a name of GoogleVR_Pawn then double-click on the GoogleVRPawn to open it up in the Blueprint Editor.

    HT_GoogleVR_Camera_Setup_03.png

  6. Open up the GoogleVR_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 make sure that the Camera is a child of the Scene Component.

    Component Name

    Value

    Scene

    VRCameraRoot

    Camera

    VRCamera

    HT_GoogleVR_Camera_Setup_08.png

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

  7. First, open up the GoogleVR_Pawn Blueprint and in the Event Graph drag off the Event Begin Play node to show the Executable Actions list. In the list search for the Set Tracking Origin node and click on it to add it to the Event Graph.

    HT_GoogleVR_Camera_Setup_06.png

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

    Click for full image.

  9. Create a new Vector variable called CameraHeight and set the Z value to 180 .

    HT_GearVR_Camera_Setup_03.png

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

  10. 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.

  11. Connect the Camera Height 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 the above image and pressing CRTL + C to copy the graph. Once copied, go to your Blueprints event and press CTRL + V to paste it in.

  12. Drag the GoogleVR_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.

  13. Select the GoogleVR_Pawn Blueprint. In the Details Panel , under the Pawn setting, change the value of Auto Possess Player from Disabled to Player 0 .

    HT_GoogleVR_Camera_Setup_05.png

End Result

Finally, go to the Main Toolbar and click on the small white triangle next to Launch Options , then select your Android device from the list to start the packaging and deployment process for that device. When that is completed put your smartphone into your HMD to allow you to view your UE4 project in VR.

HT_GearVR_Camera_Setup_08.png

Unreal Engine Project Downloads

Below, you will find a link to where you can download the Unreal Engine project that was used to create this example:

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss