Marker-Based Location Sharing APIs (AIO)
-
These APIs can only be used with compatible All-in-One (AIO) VR applications developed using the VIVE Wave VR SDK. For APIs designed for use with PC VR applications, see Marker-Based Location Sharing APIs (PC VR).
-
The JSON file markers_list_escape.json generated when creating markers with the VIVE ArUco Marker Generator contains the marker information needed for the following APIs. For details, see ArUco marker JSON files.
Configure marker ID and dictionary
Configures the marker ID and dictionary for one or two ArUco markers. Location sharing only starts after users scan the secondary marker when configuring two markers.
One ArUco marker
string polling_value; string key = "PLAYER00InitMA"; key += "{\"marker1\": {\"id\": 66,\"behavior\": 3,\"size\": 0.280}}"; uint RETURN_SIZE = 256; IntPtr value = Marshal.AllocHGlobal(new IntPtr(RETURN_SIZE)); Interop.WVR_GetParameters(WVR_DeviceType.WVR_DeviceType_HMD, Marshal.StringToHGlobalAnsi(key), value, RETURN_SIZE); polling_value = Marshal.PtrToStringAnsi(value); Marshal.FreeCoTaskMem(value); if(string.Compare(polling_value, "InitErr") == 0) // Handles the case where initialization failed. Check the configuration string to determine the cause of the error and write the appropriate error handling code. { // Write your error handling code here. } |
Two ArUco markers
string polling_value; string key = "PLAYER00InitMA"; key += "{\"marker1\": {\"id\": 66,\"behavior\": 3,\"size\": 0.280,\"isMainMarker\": true,\"pairMarkerID\": 88},\"marker2\": {\"id\": 88,\"behavior\": 0,\"size\": 0.280,\"isMainMarker\": false,\"pairMarkerID\": 66}}"; uint RETURN_SIZE = 256; IntPtr value = Marshal.AllocHGlobal(new IntPtr(RETURN_SIZE)); Interop.WVR_GetParameters(WVR_DeviceType.WVR_DeviceType_HMD, Marshal.StringToHGlobalAnsi(key), value, RETURN_SIZE); polling_value = Marshal.PtrToStringAnsi(value); Marshal.FreeCoTaskMem(value); if(string.Compare(polling_value, "InitErr") == 0) // Handles the case where initialization failed. Check the configuration string to determine the cause of the error and write the appropriate error handling code. { // Write your error handling code here. } |
Scan marker
Prompts the headset's tracking engine to detect an ArUco marker and process the data.
string key = "ClearRecenterXform"; Interop.WVR_SetParameters(WVR_DeviceType.WVR_DeviceType_HMD, Marshal.StringToHGlobalAnsi(key)); // This clears the recenter transform for the headset and other tracking devices or objects. You can also manage each device separately, but this is not necessary for most applications. key = "PLAYER00StartScan"; uint RETURN_SIZE = 256; IntPtr value = Marshal.AllocHGlobal(new IntPtr(RETURN_SIZE)); Interop.WVR_GetParameters(WVR_DeviceType.WVR_DeviceType_HMD, Marshal.StringToHGlobalAnsi(key), value, RETURN_SIZE); Marshal.FreeCoTaskMem(value); |
Stop scan and reset position
Stops the scanning process and resets the headset position to the default parameters.
string key = "PLAYER00StopScan"; uint RETURN_SIZE = 256; IntPtr value = Marshal.AllocHGlobal(new IntPtr(RETURN_SIZE)); Interop.WVR_GetParameters(WVR_DeviceType.WVR_DeviceType_HMD, Marshal.StringToHGlobalAnsi(key), value, RETURN_SIZE); Marshal.FreeCoTaskMem(value); |
Check scan status (optional)
Checks the status of the latest scan at regular intervals.
string key = "PLAYER00CheckMA"; uint RETURN_SIZE = 256; IntPtr value = Marshal.AllocHGlobal(new IntPtr(RETURN_SIZE)); Interop.WVR_GetParameters(WVR_DeviceType.WVR_DeviceType_HMD, Marshal.StringToHGlobalAnsi(key), value, RETURN_SIZE); string polling_value = Marshal.PtrToStringAnsi(value); Marshal.FreeCoTaskMem(value); if (string.Compare(polling_value, "CTdone") == 0) { // Handles the case where all markers have been scanned. } else if (string.Compare(polling_value, "CTpass") == 0) { // Handles the case where the 1st marker has been scanned, if you are using 2 markers. Remove this code if you are using 1 marker. } |
Resume location sharing
When you exit an application during play, location sharing will stop and the headset position will reset to the default parameters. This API resumes location sharing and restores the headset position using the latest available location sharing data after you reopen the application.
string key = "PLAYER00CheckMA"; uint RETURN_SIZE = 256; IntPtr value = Marshal.AllocHGlobal(new IntPtr(RETURN_SIZE)); Interop.WVR_GetParameters(WVR_DeviceType.WVR_DeviceType_HMD, Marshal.StringToHGlobalAnsi(key), value, RETURN_SIZE); string polling_value = Marshal.PtrToStringAnsi(value); Marshal.FreeCoTaskMem(value); if (string.Compare(polling_value, "CTdone") == 0) { key = "ClearRecenterXform"; Interop.WVR_SetParameters(WVR_DeviceType.WVR_DeviceType_HMD, Marshal.StringToHGlobalAnsi(key)); // This clears the recenter transform for the headset and other tracking devices or objects. You can also manage each device separately, but this is not necessary for most applications. |