First, I’d like to send a huge shout out to Brantly McCord, Purdue grad student and fantastic game dev instructor, for showing me how to create this gaze navigation Blueprint. I couldn’t have done it without him!
In this game, there is a VR Pawn that is basically a camera with a very long cube stuck out the front of it. When the player gazes around the scene while wearing the VR headset, their gaze is mirrored by the camera, which allows the cube to sweep around the scene as a sort of pointer. (This happens invisibly in the game, as you can see in the inset VR_Pawn picture above.) This pointer may overlap a trigger capsule when the player’s gaze sweeps over it. If the gaze pointer does overlap the trigger capsule, certain events are triggered. One of those events that can be triggered is the gaze navigation system, which allows the player to “teleport” to the different spheres in the game simply by gazing at them for 2 seconds. This eliminates the need for controllers – the player simply looks where they want to go next. A particle system that looks like a glowing Spirograph lights up around that sphere, indicating that the player’s gaze has landed on it. The player must keep their gaze steady for two seconds, and then they warp to that spot.
Above is the Level Blueprint for the entire gaze navigation mechanism, along with event triggers for particles and sound. What we have is a basic flow of logic that is copy/pasted for each of the 7 sphere triggers. When the user’s gaze overlaps the trigger surrounding that sphere, the logic checks to see if the gaze remained steady on the trigger for 2 seconds, and if so, teleports or “warps” the user’s position (via the VR Pawn) to that sphere.
So for instance, the game checks to see if the VR Pawn is looking at the trigger. If true, a timer is set for 2 seconds. When that time elapses, (time left is less than or equal to zero) then SetActorLocation moves the VR Pawn to that trigger the player was gazing upon.
This logic is repeated for each of the 7 sphere triggers.
There is also a system for spawning the Spirograph Particle and sound cues when the VR Pawn gazes at the sphere trigger. Sound cues include a brief verbal description of the current chakra’s name, a positive affirmation to assist in meditation, and a subtle “gong” sound effect when the player teleports.
Once the player has ascended through all seven spheres in that chakra level, they ascend to the next chakra level. There are seven chakras in all.