Unreal Engine – Oculus Gaze Input

Posted by on Nov 1, 2016 in VR Prototypes, VR/AR | No Comments

This is my adventure in trying to get the Oculus Gaze Input to work with Unreal Engine 4.13. After much research, forum reading, and youtube surfing this is how you set up the initial actions.

blueprint-07

 

I am currently running through some simple prototypes and creating them both in parallel in Unreal and Unity. It’s been an interesting learning experience so far. If you’ve ever learned how to ski and snowboard, you know that learning how to initially ski is easy. It takes longer to learn skiing at a professional level. Snowboarding on the flip-side is so hard to learn and very easy to reach “expert-level” (as long as you practice). What I have learned so far in this experience is that Unreal is like snowboarding and Unity is like skiing. What I was able to do with one line of code to get an interactable cube in Unity took numerous actions and 4 different blueprints to do the same in Unreal. But in the long run, once I get the motions down, doing more complicated actions will be easier in Unreal (at least until I learn some more C#).

The cube example I mention above begins like this: for “Event On Focus” I had it print the string of “FN2187” to test the gaze input. This is equivalent of writing this (below) in Unity (specifically with the Google VR SDK – see last post)

[code]
public void OnGazeEnter() {
   Debug.Log ("Gaze Exit");
 }
[/code]

UnrealGif-01

blueprint-06

If you are wondering about the red line that is showing in the view, I put on a debug line to show for one frame so I could test where the gaze was coming from. This is shown in the first image on the LineTraceByChannel action. I had the camera in the wrong position when I started the level so my gaze line was coming from the floor rather than my headset. I was able to troubleshoot that because I had the gaze line on. I’ve noticed the positional tracking in Oculus is tracked, by default, to the sensor. If you want to track it by the headset so that x+ is always facing in front of the headset connect the Reset Orientation and Position action to Event BeginPlay.

blueprint-03

I then changed it up a bit so that instead of printing a string on Event On Focus it would then change the color of the box. On Focus I had the box turn red, On Blur I had it turn back to white, and On Activate I had the color parameter change to a random color each time I clicked.

blueprint-04

One issue I ran into is that the On Activate is set to work with a Left Mouse Button. I also added the Oculus Remote D-pad Left into the same action but cannot get it to work. If anyone has any ideas feel free to comment below!

blueprint-02

Here is the new outcome with the above blueprints.

UnrealGif-03

 

Leave a Reply