WaveVR API Usage Restriction

Introduction

In WaveVR, there are some APIs that can be called only once in a frame.

If those are called two or more times in a frame, the result will be abnormal.

Do NOT use the APIs listed below because those are already called by the Unity engine SDK once in a frame:

  • WVR_GetSyncPose: to get a device pose, use sample code
if (!Application.isEditor)
{
    if (WaveVR.Instance != null)
    {
        // Right controller
        WaveVR.Device _right = WaveVR.Instance.getDeviceByType(WVR_DeviceType.WVR_DeviceType_Controller_Right);
        // Left controller
        WaveVR.Device _left = WaveVR.Instance.getDeviceByType(WVR_DeviceType.WVR_DeviceType_Controller_Left);

        // Set to right pose
        gameObject.transform.localPosition = _right.rigidTransform.pos;
        gameObject.transform.localRotation = _right.rigidTransform.rot;

        // Set to left pose
        gameObject.transform.localPosition = _left.rigidTransform.pos;
        gameObject.transform.localRotation = _left.rigidTransform.rot;
    }
}
  • WVR_PollEventQueue: to receive a system event, use sample code
void OnEnable()
{
    WaveVR_Utils.Event.Listen (WaveVR_Utils.Event.ALL_VREVENT, OnEvent);
}

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

void OnEvent(params object[] args)
{
    WVR_Event_t _event = (WVR_Event_t)args[0];
    switch (_event.common.type)
    {
            // Cases of event ...
    case WVR_EventType.WVR_EventType_ButtonPressed:
        break;
    case WVR_EventType.WVR_EventType_RecenterSuccess:
    case WVR_EventType.WVR_EventType_RecenterSuccess3DoF:
        break;
    }
}