Tech Notes: Detecting Reset View Events with Unreal
Oculus Developer Blog
|
Posted by Eric Cosky
|
May 10, 2017
|
Share

People using Rift aren’t always facing the same direction or sitting in the exact same place when using VR applications. While the Oculus Guardian System works well for keeping people aware of their predefined play area’s boundaries, sometimes people prefer to reposition themselves or simply face a different direction while playing. There are any number of reasons why people might want to face a different direction or shift where they’re sitting or standing while using Rift—it might be as simple as using a different chair or footrest that requires them to face a different direction. That’s why it’s important that applications support the “Reset View in VR” command available in the Oculus Universal Menu.

When a person resets the view in the Universal Menu, the VR application should detect this event and use the current position and orientation of the HMD as the default location with a forward-facing orientation. Failing to support this event properly has been a frequent source of submission failures on the Oculus Store. This post is intended to help developers understand how to properly detect and respond to the Reset View event with Unreal Engine 4.

The following sample shows how to set up Blueprints to bind the HMDRecenteredDelegate event to handler nodes, which will reset the camera’s position and orientation as required. This Blueprint logic can exist anywhere you like as long as it’s always active and ready to respond to the events. In the provided sample, a custom GameMode was created to let us create a custom pawn to use for containing this logic. An actual project would likely just add the reset view logic to an existing pawn.

Next, set up the Blueprint for pawn to bind the event handler for the HMDRecentered event by dragging the “HMDRecentered Delegate” over the graph and selecting “Create and bind event”.

This will create the two nodes required for detecting the event.

Next, create the VRNotifications component, drag it onto the graph, and hook up the output pin to the target for the Bind Event node.

Finally, create a “Reset Orientation and Position” node and connect it to the execution pin of the event as shown above.

Once this is compiled and running, you can test the behavior to see how it responds to the reset view event. Try moving to different locations and facing different directions, then activate the Universal Menu and trigger the Reset View command. You’ll see the orientation and position reset to place you on top of the map’s center facing forward down the X axis.

We hope you find this information useful. Stay tuned for future Tech Notes!