This script WaveVR_Utils.cs has many tools.
Register and unregister event listener.
Expose of native code
Native code here is NOT for developer.
Convert pose from Matrix to Quaternion and position by
Add Android’s systrace tag in C#.
Render thread event handle
Trigger a render thread event. Not for Developer.
Event listener can receive event from sender with a listened message. In
Event, there are defined event names for different purpose. And also events
WVR_EventType can be listen to.
‘Listen’ the ‘message’ with callback ‘action’ in game object OnEnable, and ‘Remove’ them in OnDisable.
The pre-defined events are
Listener will receive a device connect stat when a scene is loaded. Even the device didn’t disconnect, the connect stat will send again if scene was loaded. But will not send the disconnected again.
This event can help show or hide a controller according to its connection stat.
Every frame the WaveVR_PoseTracker will receive this event once to update the devices’ pose. You can listen to this event for your purpose.
This event will be triggered by updatePoses() in WaveVR. In the WaveVR_Render, when a frame is about to render, the updatePoses() will be invoked. And the transform of game object with the WaveVR_PoseTracker will be changed.
After all NEW_POSES was delivered, this event will be sent. Use it for your necessary.
Every frame the WaveVR_Init will help to poll event by pollEventQueue(). Because the pollEventQueue() should be only used in one place, script which interest with the all VREvents should listen to this ALL_VREVENT.
Or you can listen to a single event by event types’ name,
enum.ToString(). For example:WaveVR_Utils.Event.Listen(WVR_EventType.WVR_EventType_RecenterSuccess.ToString(), onSuccss);