WaveVR System Events

Contents

Introduction

Important: Please do NOT use API ``WVR_PollEventQueue``, we provide the broadcasts of events those that you can use.

In WaveVR, there are some system events that can be received in Unity.

enum WVR_EventType

event type

Values:

WVR_EventType_Quit = 1000

common event region Application Quit.

WVR_EventType_SystemInteractionModeChanged = 1001

WVR_InteractionMode changed. Use WVR_GetInteractionMode to get the interaction mode.

WVR_EventType_SystemGazeTriggerTypeChanged = 1002

WVR_GazeTriggerType changed. Use WVR_GetGazeTriggerType to get the gaze trigger type.

WVR_EventType_TrackingModeChanged = 1003

Notification for tracking mode change(3 DoF/6 DoF). Use WVR_GetDegreeOfFreedom to get the current tracking mode.

WVR_EventType_RecommendedQuality_Lower = 1004

Notification for recommended quality to be Lower from runtime.

WVR_EventType_RecommendedQuality_Higher = 1005

Notification for recommended quality to be Higher from runtime.

WVR_EventType_HandGesture_Changed = 1006

Notification for changed gesture.

WVR_EventType_HandGesture_Abnormal = 1007

Notification for abnormal gesture.

WVR_EventType_HandTracking_Abnormal = 1008

Notification for abnormal hand tracking.

WVR_EventType_DeviceConnected = 2000

Device events region WVR_DeviceType is connected.

WVR_EventType_DeviceDisconnected = 2001

WVR_DeviceType is disconnected.

WVR_EventType_DeviceStatusUpdate = 2002

WVR_DeviceType configuration has changed.

WVR_EventType_DeviceSuspend = 2003

When user takes off the HMD

WVR_EventType_DeviceResume = 2004

When user puts the HMD back on

WVR_EventType_IpdChanged = 2005

The interpupillary distance has changed; Use WVR_GetRenderProps to get the current IPD.

WVR_EventType_DeviceRoleChanged = 2006

WVR_DeviceType controller roles have switched.

WVR_EventType_BatteryStatusUpdate = 2007

The battery status of WVR_DeviceType device has changed. Use WVR_GetBatteryStatus to check the current battery status.

WVR_EventType_ChargeStatusUpdate = 2008

The charged status of WVR_DeviceType device has changed. Use WVR_GetChargeStatus to check the current battery charge status.

WVR_EventType_DeviceErrorStatusUpdate = 2009

WVR_DeviceType device error occurs. Use WVR_GetDeviceErrorState to get the current error status from the device service.

WVR_EventType_BatteryTemperatureStatusUpdate = 2010

The battery temperature status of WVR_DeviceType device has changed. Use WVR_GetBatteryTemperatureStatus to check the current battery temperature.

WVR_EventType_RecenterSuccess = 2011

Notification for successful recenter for the 6 DoF device

WVR_EventType_RecenterFail = 2012

Notification for recenter failed for the 6 DoF device

WVR_EventType_RecenterSuccess3DoF = 2013

Notification for recenter successful for the 3 DoF device

WVR_EventType_RecenterFail3DoF = 2014

Notification for recenter failed for the 3 DoF device

WVR_EventType_PassthroughOverlayShownBySystem = 2100

Notification for passthrough overlay is shown by the system.

WVR_EventType_PassthroughOverlayHiddenBySystem = 2101

Notification for passthrough overlay is hidden by the system.

WVR_EventType_ButtonPressed = 3000

Input Event region WVR_InputId status changed to pressed.

WVR_EventType_ButtonUnpressed = 3001

WVR_InputId status changed to not pressed

WVR_EventType_TouchTapped = 3002

WVR_InputId status changed to touched.

WVR_EventType_TouchUntapped = 3003

WVR_InputId status changed to untouched.

WVR_EventType_LeftToRightSwipe = 3004

Notification for swipe motion (left to right) on the touchpad

WVR_EventType_RightToLeftSwipe = 3005

Notification for swipe motion (right to left) on the touchpad

WVR_EventType_DownToUpSwipe = 3006

Notification for swipe motion (down to up) on the touchpad

WVR_EventType_UpToDownSwipe = 3007

Notification for swipe motion (up to down) on the touchpad

All Events

In the scripts those inherit MonoBehaviour, you can use the sample code below to listen to the broadcasts of events:

void OnEnable()
{   // Listen to event
    WaveVR_Utils.Event.Listen (WaveVR_Utils.Event.ALL_VREVENT, OnEvent);
}

/// Event handling function
void OnEvent(params object[] args)
{
    WVR_Event_t _event = (WVR_Event_t)args[0];
    // Check the event, e.g. WVR_EventType_RecenterSuccess
    if (_event.common.type == WVR_EventType.WVR_EventType_RecenterSuccess)
    {
    }
}

DPad Operation Events

You can listen to the ALL_VREVENT event to check DPad operation events.

The below introduces another broadcast for DPad operation events.

Description

  • WVR_EventType_LeftToRightSwipe: triggered when swiping from left to right on touchpad.
  • WVR_EventType_RightToLeftSwipe: triggered when swiping from right to left on touchpad.
  • WVR_EventType_DownToUpSwipe: triggered when swiping from down to up on touchpad.
  • WVR_EventType_UpToDownSwipe: triggered when swiping from up to down on touchpad.

Resources

The sample scene Event_Test is located in Assets/Samples/Event_Test

The sample script Event_Test.cs is located in Assets/Samples/Event_Test

Sample Code

Event_Test listens to broadcast SWIPE_EVENT

void OnEnable()
{
    WaveVR_Utils.Event.Listen ("SWIPE_EVENT", OnEvent);
}

void OnDisable()
{
    WaveVR_Utils.Event.Remove ("SWIPE_EVENT", OnEvent);
}

After receiving an event, ths function OnEvent will handle the event.

switch (_event)
{
case WVR_EventType.WVR_EventType_LeftToRightSwipe:
    transform.Rotate (0, 180 * (10 * Time.deltaTime), 0);
    break;
case WVR_EventType.WVR_EventType_RightToLeftSwipe:
    transform.Rotate (0, -180 * (10 * Time.deltaTime), 0);
    break;
case WVR_EventType.WVR_EventType_DownToUpSwipe:
    transform.Rotate (0, 0, 180 * (10 * Time.deltaTime));
    break;
case WVR_EventType.WVR_EventType_UpToDownSwipe:
    transform.Rotate (0, 0, -180 * (10 * Time.deltaTime));
    break;
}