Unreal Vive Bare Minimum From Scratch ExplainedAugust 6, 2016 | vive unreal engine development vr
This describes the bare minimum of steps to get into Unreal in VR from scratch with an understanding of everything you did to get there. The focus is what is required to build an actual VR app, not editing in VR, which is an additional editing mode inside the Unreal editor.
Unreal consists of the Epic Launcher and the Unreal Editor. You can download the Epic Launcher and use it to install different versions of the editor/engine.
You must create an account, which only requires an email address. Install the Launcher and check to make sure it installs the 4.12.5 engine or greater.
Build VR Project
This video shows a quick run through of the below if at any point you get confused about where a button or selection is:
Start SteamVR using Steam.
Launch an Unreal Editor instance from the Launcher using the big yellow Launch button.
The editor starts up the Unreal Project Browser, click on New Project and choose these settings:
- Desktop/Console = Mobile/Tablet
- Maximum Quality = Scalable 2D or 3D
- With Starter Content = No Starter Content
The first two settings reduce rendering effects to improve frame rate and prepare the project for alternative input methods to keyboard and mouse. Starter Content is a collection of objects and other items you can place in your level to test things out. They could be useful to you later, but this sticks strictly to bare minimum.
Select the location to store your project folder and name it ViveUnreal. Click Create Project.
This will create your project folder and start up the Unreal Editor. You will see a default level loaded. The level is just a collection of objects that define a space in which you can place things, have them interact, and render any perspective of them to your monitor and Vive. Save this level using File -> Save As. Name it Minimum.
Create Your Head
We must create a character to represent you in the world. Specifically, your head and eyes as well as both hands. To do this, we create a pawn, which is a collection of objects representing these things that can be put into the world and moved around in it by your headset and controller tracking data.
Click on Window -> Content Browser or the Content Browser tab at top. Click on the Add/New button and create a new Blueprint Class with Pawn as its parent. Name it VR_Pawn. A blueprint is a collection of components and logic that make up a thing that can exist in your level.
Open the VR_Pawn by double clicking it in the Content Browser. Give the pawn a head and eyes by clicking on the big green Add Component button and adding a Camera component. Typing the name of the component you want to add in the little white text field that pops up shortens the list. For example, type "Camera".
A camera is a perspective from which the world is rendered. It corresponds to the perspective of the panels in your Vive headset. One panel will be rendered from a perspective slightly to the left of the virtual camera lens midpoint and the other panel slightly to the right.
Create Your Hands
Now we must add your hands and controllers. Add two MotionController components to the pawn we are building in the same way you added the camera. These components translate the tracking data from your controllers into positions in the virtual space. By default, a MotionController component tracks your left controller. Select the second component, named MotionController1 by default. In the Details panel to the right, change the Hand dropdown to Right. Now both your left and right hand/controllers are tracked by separate MotionController components.
Even though the controllers are tracked, we haven't specified how they will appear. Click on the green Add Component button again and add a Static Mesh component. A static mesh is just a three-dimensional object with surfaces to which we can apply textures, which are basically processed images. In this case, we'll let the engine apply the default texture, which is a grayish grid material.
With the static mesh component selected in the Components panel at left, go to the Details panel at right and click the small white drop down arrow in the Static Mesh panel. The dialog that comes up will be empty, but have a View Options dropdown in its lower right. Click on this and enable Show Engine Content. This enables the panel to display basic shapes that are included in the engine itself. Scroll down and select Cone as your static mesh.
Before leaving the Details panel for the static mesh, let's make the static mesh smaller because the default size of a built-in static mesh is too large to represent your hand. Change the Scale X, Y, and Z fields to 0.1. Finally, change the Collisions Preset to NoCollisions so that the static mesh can spawn and move anywhere in the world without colliding with other things like the virtual floor.
This static mesh cone will be your visible left hand. To connect it to the tracking data for your left controller, drag it onto the first MotionController component you added, named MotionController by default, in the Components panel at left. This makes the MotionController component the parent of the static mesh so that wherever the controller moves, the static mesh moves.
Repeat this same process to create another Static Mesh for your right hand, except choose Cube instead of Cone and drag it onto the right hand MotionController, named MotionController1 by default.
Place Yourself In World
We must tell the engine to use your VR_Pawn as your proxy in the world so that it looks where you look and its hands go where your hands go. Close the VR_Pawn and go back to the Content Browser. Click Add New and add another Blueprint class with parent of GameMode. Name it VR_GameMode. Double click to open it up and set the Default Pawn in the Details panel at right to VR_Pawn. Make sure to click the Compile button in the toolbar at top before closing the VR_GameMode, which makes the pawn setting available to play in the editor.
A game mode is a collection of settings that determine how a game should run by identifying certain things that will be used by the engine as it runs the game. For example, you indicated that the VR_Pawn should represent you, the player. To identify this VR_GameMode as the game mode to use, close the VR_GameMode tab and go back to the level editor. Click on Window -> World Settings. In the panel to the right, set the GameMode Override to VR_GameMode.
The engine must place you somewhere in the world when you start. This is controlled by the Player Start capsule that is already placed in the level. Click on Window -> Word Outliner and select Player Start in the outline at right. With that selected, in the Details panel for the Player Start capsule, also at right below the outliner, change the Location Z value to 20.0. This controls how far above the virtual floor the helmet's perspective would be if it was sitting on the physical floor. The default player start has the helmet offset about 1 meter above the virtual floor when it is actually on the physical floor. This change of the Location Z value to 20.0 aligns the top of the virtual floor with the top of the physical floor.
Step Into VR
In the toolbar at top, click the white dropdown arrow to the right of the Play icon. Choose VR Preview. Unreal will start playing the game in the editor and a game preview window will come up.
Put your headset on and wave your controllers around.
Build Your World
To add things to your level, select Windows -> Modes and click on the box and lightbulb icon at upper left in the Modes panel. Choose the Basic collection of classes and drag one of Cube, Sphere, Cylinder, or Cone into the level. Position it a little way in front of the blue arrow extending from the Player Start capsule. Launch VR Preview again and you will see it in front of you. If you have enough space in your play area, you should be able to walk around it.
So far, everything in the world has remained static except for you. For example, if you dragged a Cube into your level, you could walk around it, but it didn't move. For a really quick way to put things in motion, check out Actor Waypoints. If you want to dig deeper, see Blueprints and Sequencer.
Congratulations, you are now a VR developer. With a bit more effort, you can now create Witcher 3 in VR. Go!
If you have problems getting the virtual floor and the physical floor to line up, double check you added a Camera component to your VR_Pawn. If you do not add a Camera component to your VR_Pawn, Unreal will use a default camera with a different vertical offset and the height will not feel right. Do Vive room setup again if this doesn't fix it.
If you do not see one or both of your controllers, make sure you set the Collisions Preset to NoCollision for both the static meshes you connected to the MotionController components and that you set one MotionController component to the left hand and one to the right. Also, make sure you compiled the VR_GameMode blueprint. If the Cube is a lot bigger than the Cone even at 0.1 scale, pick the other cube in the static mesh dropdown list.
If you have trouble with the Cube appearing as your left hand and the Cone appearing as your right hand, be aware that as of this writing it appears that Unreal assigns the first controller you turn on as the left MotionController and the second as the right.
If you restart the editor and open up the ViveUnreal project again, you will start with a new default level. To open the level you edited, File -> Open Level and select Minimum. To make the editor always open Minimum when opening the ViveUnreal project, go to Edit -> Project Settings -> Maps & Modes and set Editor Startup Map to Minimum.