Share via


Gaze Detection with Unity & Oculus Rift

Hey guys,

I've been exploring things in Unity that look especially cool with the Oculus Rift on, and one of my favorite things is when objects appear seemingly out of nowhere. ie you look to the left, you look away, and when you look back there is a new object there. Some people call this "gaze detection".
You can see something like this in Sightline the Chair. I don't know if this is *exactly* how they did it, but if you are interested in how I emulated this effect, check out the script below.

 

 

 

By attaching this script onto your First Person Controller, you can then specify the number of game objects in the inspector and drag in your game objects. Since this is a universal script, you can reuse it and change out the game objects as you'd like, since the array rotates through the public game objects you specify.

 

 It should look something like this. If you want the scripts and the whole project, you can download them here

 

 

Here it is in Sightline if you don't know what i'm talking about.