2. Setting up UE4 to work with SteamVR

Choose your OS:

In the following section, we will go over how to setup a new Unreal Engine 4 (UE4) project to work with SteamVR.

If you have not done so already, make sure to run the SteamVR Room Setup to establish and calibrate the VR tracking area. Failing to do this could result in SteamVR and UE4 not working correctly together.

  1. Create a new blank Blueprint base project with hardware set to Mobile / Tablet, graphics set to Scalable 3D or 2D and No Starter Content.

    T_CreateNewProject.png

  2. Once the project loads click on the small triangle next to the Play button and then from the menu that is displayed, select the VR Preview option. If your VR Headset is properly set up, you should now see the basic level being displayed and have the ability to rotate your head around in any direction when you put the HMD on.

    Check_VR_Working_00.png

    If your can not get the HTC Vive HMD to work check the Plugins section to make sure that the Steam VR plug-in is enabled and if not click on the checkmark box next to Enable to enable it. T_Enable_Steam_VR.png If that still does not get your VR Headset to work with the VR Preview make sure to check out the VR Documents to ensure that nothing was missed during setup.

  3. With verification that the Head Mounted Display (HMD) is working, right - click inside of the Content Browser and select the Blueprint Class option from the Create Basic Asset section.

    Create_New_BP.png

  4. From the Pick Parent Class window that is displayed search for, create and name the following Blueprint nodes.

    Pick_Parent_Class_Window.png

    Blueprint Node

    Name to use

    Game Mode

    VR_GameMode

    Pawn

    VR_Pawn

    When completed you should have the following Blueprints in your Content Browser.

    Creating_Required_BP_Nodes.png

  5. Open VR_GameMode Blueprint and then under the Classes section change the Default Pawn Class to point to the VR_Pawn that was created.

    Setting_Up_Game_Mode.png

  6. Under World Settings in the Game Mode section, change the GameMode Override to the VR_GameMode.

    Adding_New_GameMode.png

  7. Now open up the VR_Pawn Blueprint then click on the Class Defaults and in the Details panel under the Camera section set the Base Eye Height to 0.0.

    Set_Base_Eye_Height.png

  8. From the Components tab, add the following Components to the VR_Pawn Blueprint.

    Component Name

    Amount

    Capsule

    1

    Scene

    1

    Camera

    1

    SteamVRChaperone

    1

    Adding_A_Camera.png

  9. Select the Capsule Component and under the Details panel in the Shape section, change the Capsule Half Height to 96 and the Capsule Radius to 16.

    Capsule_Setup.png

  10. Click on the Camera and then drag it on top of the Scene Component, making the Camera a child of the Scene Component.

    Parenting_The_Camera.png

  11. Select the new Scene Component and go to Details > Transform > Location and set the Z value to -110 then make sure to Compile and Save the Blueprint.

    Change_Scene_Height.png

  12. Inside of the level, select the Static Mesh used for the floor and set the X, Y and Z location to 0,0,0.

    Move_Floor_Down.png

  13. Launch the level using the VR Preview button, put your HMD on and then stand up and look around. When you look down at your feet, you should now feel as though the virtual floor that you are standing on matches up to the real world floor.

If it feels like you are too close or too far away from the virtual floor, open the VR_Pawn Blueprint, select the Scene Component that the Camera is parented to and adjust the Z height value up or down till the floor feels like it is in the correct location for your height.