WVR_GetDefaultControllerRole¶
- WVR_EXPORT WVR_DeviceType WVR_GetDefaultControllerRole()
Function to get the default controller role which will determine the role while the first controller connects.
- Return
- The type of controller role, it will be WVRDeviceType_Controller_Right or WVRDeviceType_Controller_Left. (refer to WVR_DeviceType)
How to use¶
Here is an example for the function:
#include <wvr/wvr_types.h>
#include <wvr/wvr_events.h>
// catch event which is sent from VR server or device service or settings AP
WVR_Event_t event;
while (WVR_PollEventQueue(&event)) {
switch (event.common.type) {
…
case WVR_EventType_Settings_ControllerRoleChange:
// do something when controller role exchange
WVR_DeviceType role = WVR_GetDefaultControllerRole(); // get default controller role
if ( role == WVR_DeviceType_Controller_Right ) {
// first controller is right hand
…
} else if ( role == WVR_DeviceType_Controller_Left ) {
// first controller is left hand
…
}
if (WVR_IsDeviceConnected(role)) {
WVR_PoseState_t pose;
WVR_GetPoseState(role, WVR_PoseOriginModel_OriginOnHead, 0, &pose);
}
break;
…
}
}