Jump to content

Legacy to XR Plugin migration - system events


ssid

Recommended Posts

I am in the process of migrating to the new Wave XR Plugin from the legacy VR plugin which I have been using for a while. So far I have got the XR rig camera/controller setup and a basic scene working on my Vive Focus+.

LEGACY VR PLUGIN:

My code was using 'WaveVR_Init' from the legacy vr plugin which was updating device events (like swipe, etc.). via its update method (below) and subscriptions were possible through 'WaveVR_Utils'. Code snippets from the legacy plugin usage below:

    WVR_Event_t vrevent = new WVR_Event_t ();
    void Update()
    {
        bool ret = Interop.WVR_PollEventQueue (ref vrevent);
        if (ret)
            processVREvent (vrevent);
    }

WaveVR_Utils.Event.Listen(WaveVR_Utils.Event.ALL_VREVENT, ProcessEvent);

WaveVR_Utils.Event.Remove(WaveVR_Utils.Event.ALL_VREVENT, ProcessEvent);

private void ProcessEvent(object[] args)

XR PLUGIN:

What is the best way to get all native device event updates in the new XR Plugin? I have the latest Vive Essence package downloaded. That has a 'WaveEssence' mono-behavior but most of the code in that is commented and it does not provide any device events. 

There is another script 'SystemEvent' in the Essence package which seems to deal with device event subscriptions. I do not see any example usage for it whether I just need to add it to my scene and subscribe to the event listener?

Any help would be appreciated since I am just trying to move over.

Thanks,

Sid

Link to comment
Share on other sites

  • 2 weeks later...

Hi @ssid,

Thanks for the feedback.

Regarding the usage of system events in XR Plugin, you are correct (i.e. System events in XR Plugin are handled through the SystemEvent.cs script)

As for example usage, WaveEssence.cs contains some code which shows how to subscribe to and unsubscribe from System Events (on Monobehaviour OnEnable and OnDisable).

Link to comment
Share on other sites

10 hours ago, Tony PH Lin said:

Hi @ssid,

Thanks for the feedback.

Regarding the usage of system events in XR Plugin, you are correct (i.e. System events in XR Plugin are handled through the SystemEvent.cs script)

As for example usage, WaveEssence.cs contains some code which shows how to subscribe to and unsubscribe from System Events (on Monobehaviour OnEnable and OnDisable).

Thanks @Tony PH Lin. I was able to get it working after looking at the demo code.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...