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_InteractionModeChanged
= 1001¶ WVR_InteractionMode changed. Use WVR_GetInteractionMode to get the interaction mode.
-
WVR_EventType_GazeTriggerTypeChanged
= 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_ArenaChanged
= 1009¶ Notification for arena have been changed.
-
WVR_EventType_RenderingToBePaused
= 1010¶ Notification for the rendering is going to be paused due to user take off HMD and display off.
-
WVR_EventType_RenderingToBeResumed
= 1011¶ Notification for the rendering is going to be resumed due to user put on HMD and display on.
-
WVR_EventType_SpectatingStarted
= 1012¶ Notification for the spectating started.
-
WVR_EventType_SpectatingStopped
= 1013¶ Notification for the spectating stopped.
-
WVR_EventType_SpatialAnchor_Changed
= 1101¶ Notification for the spatial anchor changed.
-
WVR_EventType_CachedAnchor_Changed
= 1102¶ Notification for the cached anchor changed.
-
WVR_EventType_PersistedAnchor_Changed
= 1103¶ Notification for the persisted anchor changed.
-
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¶ (deprecated)
-
WVR_EventType_DeviceResume
= 2004¶ (deprecated)
-
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_ClearHmdTrackingMapDone
= 2015¶ Notification of the finish of clearing operation of HMD tracking map from device service.
-
WVR_EventType_InputDevMappingChanged
= 2016¶ Notification for input device mapping table changed.
-
WVR_EventType_BatteryPercentageUpdate
= 2017¶ The battery percentage of WVR_DeviceType device has changed. Use WVR_GetDeviceBatteryPercentage to check the current battery level.
-
WVR_EventType_DeviceInfoUpdate
= 2018¶ The device information of WVR_DeviceType device has changed.
-
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_ControllerPoseModeChanged
= 2102¶
-
WVR_EventType_ControllerPoseModeOffsetReady
= 2103¶
-
WVR_EventType_DeviceTableStaticLocked
= 2104¶ WVR_DeviceType is on table static state.
-
WVR_EventType_DeviceTableStaticUnlocked
= 2105¶ WVR_DeviceType is not on table static state.
-
WVR_EventType_ManualFocusChanged
= 2106¶ Notification for manual focus is changed.
-
WVR_EventType_Hand_EnhanceStable
= 2900¶ Hand and Wrist Tracker event Notification for Enhanced Hand Stability ON or OFF
-
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
-
WVR_EventType_TrackerConnected
= 4000¶ Tracker events region WVR_TrackerId is connected.
-
WVR_EventType_TrackerDisconnected
= 4001¶ WVR_TrackerId is disconnected.
-
WVR_EventType_TrackerBatteryLevelUpdate
= 4002¶ The battery level of WVR_TrackerId has changed. Use WVR_GetTrackerBatteryLevel to check the current battery level.
-
WVR_EventType_TrackerRoleChanged
= 4003¶ WVR_TrackerId is role changed.
-
WVR_EventType_TrackerButtonPressed
= 5000¶ Tracker input events region WVR_InputId status of WVR_TrackerId changed to pressed.
-
WVR_EventType_TrackerButtonUnpressed
= 5001¶ WVR_InputId status of WVR_TrackerId changed to not pressed
-
WVR_EventType_TrackerTouchTapped
= 5002¶ WVR_InputId status of WVR_TrackerId changed to touched.
-
WVR_EventType_TrackerTouchUntapped
= 5003¶ WVR_InputId status of WVR_TrackerId changed to untouched.
-
WVR_EventType_TrackerLeftToRightSwipe
= 5004¶ Notification for swipe motion (left to right) on the touchpad of Tracker
-
WVR_EventType_TrackerRightToLeftSwipe
= 5005¶ Notification for swipe motion (right to left) on the touchpad of Tracker
-
WVR_EventType_TrackerDownToUpSwipe
= 5006¶ Notification for swipe motion (down to up) on the touchpad of Tracker
-
WVR_EventType_TrackerUpToDownSwipe
= 5007¶ Notification for swipe motion (up to down) on the touchpad of Tracker
-
WVR_EventType_BodyTrackingCalibrationChanged
= 6000¶ BodyTracking events region Notification for BodyTracking calibration parameters change
-
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;
}