Using HeadsetManager

The HeadsetManager is responsible for Zappar's support of AR/VR headsets, such as Google Cardboard.

It includes a number of functions and events that help to create headset experiences.

Creating a HeadsetManager

To create a HeadsetManager, right click on the root node in the Hierarchy and select 'New > HeadsetManager' and give it a name.

Enabling Headset Mode

To enable headset mode simply drag the newly created HeadsetManager node from the Hierarchy into a script node and select useHeadset from the dropdown.

The usingHeadset( ) function can be called from a script node to determine wether or not the device is currently in headset mode. This is useful for providing different functionality depending on which mode the user is in.

In some situations the device may not enter headset mode immediately and instead go through a configuration stage. Use the headsetenter and headsetleave events to change UI and behavior for each mode.

Users can return from headset mode by tapping on the "exit-headset" button.

The headsetbutton Event

In addition to events emitted when the device has entered or left headset mode, there is also an event that is emitted when the user taps anywhere on the screen within headset mode (with the exception of the "exit-headset" button).

It's the headsetbutton event, and it's a key way for building interactivity into a headset experience. Note that it requires that the user can access the screen of the device with their finger through a hole in their headset.

Note that standard pointer events (i.e. pointerenter/leave/down/up) are not emitted while in headset mode.

To create a headsetbutton event handler right click on a HeadsetManager node and select 'New > Script > headsetbutton'.

Next Steps

ZapWorks Studio supports the camera view in headset mode. There are some important additional considerations when tracking targets in headset mode - for more information, check out the Tracking in Headsets article.

zapcode branded_zapcode i