Unreal Engine has a section in their Gear VR documentation on how to build cameras, set up functions for Gear VR touchpad, and the motion controller. While these are helpful, it would be great if there was more support for Gear VR built into Unreal instead of developers having to custom-build things. Also, be aware that sometimes Unreal’s documentation is not up to date, and you may need to cross-reference against Oculus’s Developer documentation as well.
Note: if you are developing for Oculus, especially for Gear VR, there are certain plugins that need to be turned on in order to get the Blueprints you need.
Oculus has a section in their documentation on Blueprints, and how to turn on the plugin. So far the documentation is a bit vague and sketchy, but I hope to continue deciphering it.
The Input Blueprint provides a control interface for Touch, Oculus remote, and the Gear VR Controller….Gear VR Controller clickpad events are reported in the Input Blueprint as thumbstick events.
What would be really helpful, would be an Input option to use the Gear VR touchpad or motion controller built into the Inputs/action mapping. So far that does not seem to be an option. If you can use the Action and Axis bindings in the Input section, it works across the entire game and all levels, instead of having to custom build a blueprint each time.
In this section, we added to our Blueprint, replacing the PrintScreen value with a function that allows us to move the VR_Pawn (player point of view) to the trigger capsule location when the VR_Pawn pointer overlaps the trigger capsule. In other words, when you look at something, you instantly teleport to it. Below is a pic of the player standing on top of the cauldron after gazing at it.
Below is an extreme close-up on the salamander – once the player gazed at it, the player was teleported directly to the trigger capsule surrounding the salamander.
Obviously the placement of the capsules need to be fine-tuned so the player doesn’t land so closely upon the object, but the basic interactions are now functional.
Here is the Blueprint that creates this action. Notice the Get Actor Location and Set Actor Location functions.
In this part of the Pluralsight tutorial “Making a VR Experience in Unreal Engine” we get into setting up a trigger capsule for our objects, then using Blueprints to create a PrintString when our gaze encounters the capsule surrounding the object.
We went into the Blueprint for the VR_Pawn and clicked on the Viewport tab at the top of the Blueprint to see the actual object in order to create a very long Cube that was parented to the camera. This allows us to touch or “Overlap” objects in the scene when the camera points at them.
When the gaze/pointer encounters the object, the PrintString prints the word “Hit” instead of “Miss”.
Next, we built the Blueprints to make the program print different words on the screen depending on which object it overlaps.
WAIT – there is a problem. When the gaze encounters the trigger, it prints the wrong description.
I literally had my wires crossed. I corrected the PrintString outputs.
Now the Cauldron string is connected to the Cauldron trigger, same for salamander.
We have successfully demonstrated creating an event (PrintString) when the VR_Pawn camera pointer overlaps a Trigger Capsule.
Today I’m following a Pluralsight tutorial on creating a first person camera and teleportation system using Blueprints in Unreal Engine. In this Blueprint, we are creating a way for the player to “teleport” from VR_Pawn to VR_Pawn1 when the number 1 key is pressed on the keyboard, and VR_Pawn2 when the number 2 key is pressed, allowing the player to move around the scene.
Here are the views as I click between the original, 1 and 2 keys. (Also, I updated the tree a bit from the previous image, but have not tested it in VR yet to see if the geometry “explodes.”)
The Blueprint allowed me to successfully move around the scene using keyboard keys while experimenting in the VR Preview.
This was helpful for understanding the concept, but in order for it to work in the Gear VR headset, I will need to understand how to map inputs from Gear VR instead of keyboard keys.
One of the main assets in my scene is a giant tree root. I modeled it in Maya and Zbrush, then imported it into Unreal, where it looks pretty good.
The problem is, when I export the packaged file from Unreal to my phone to view in Gear RV, the tree explodes. Below is a screenshot from Gear VR. The salamander and other elements are OK, but the tree is whacked.
Thinking that the file was too big, I created a tree with fewer polys.
This one is 43MB, 321k triangles, apprx size 1455x2098x1424.
I packaged the file for VR, and still got an exploding tree.
I simplified the tree a bit more, leaving off any of the polypainted texture, and still got an exploding tree.
This one is 41MB, 430k trianglesize 762.1307×841.
My last ditch attempt will be to create an extremely simplified version in Maya and take it straight into Unreal Engine (skipping Zbrush) and see if it works.
This low poly tree did work in the VR headset. It showed up black because it has not had any materials assigned to it.
I would like to find the “happy medium” of a tree that looks good, but does not explode.
In Unreal Engine, I was able to tweak the BP_Sky_Sphere colors to give my scene a red glow. I then created a Material by importing a PNG image of the root chakra symbol, and applied that Material to a flattened Cylinder to form the disc that appears below the tree roots.
For the music, I wanted to insert some placeholder music for now, so I selected this “Relaxing Traditional Music of West Java” that I converted to a WAV file from this Youtube video. Soon I hope to work with a local musician to use original gamalan (traditional Javanese) music instead. I watched this tutorial on how to insert background music.
Now when you hit Play, the background music plays in the scene.
First, I began in Maya by creating a low-poly basic mushroom shape.
I then imported it into Zbrush and began shaping it with the Move tool, added some texture to it and polypainted it. I then saved that mushroom as a Tool (ZLTool) and used the Append button to add it as another mushroom into my scene on a sub-layer. I repeated this process to add a third mushroom and used the move tool to bend and shape them a bit so each was unique.
Lastly I used the polynormals tool to assist with UV unwrapping, exported the texture map (colors) and the normal map (bump), then exported the mushroom meshes back into Maya so I could re-wrap the texture and bump on them and export as an FBX to Unreal.