Nothing's in my cart
Marker-Based Location Sharing APIs (AIO)
LBSS provides several application programming interfaces (APIs) to assist in
Marker-Based Location Sharing.
Note:
-
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
In this sample, the marker ID is
66, and the marker size is
0.280. This marker size value corresponds to a marker measuring 280 millimeters on each side.
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
In this sample, the marker IDs are
66 and
88 and both marker sizes are
0.280.
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.
Note: To avoid affecting system performance, do not set the checking frequency to more than two times per second.
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. |
Was this helpful?
Yes
No
Thank you! Your feedback helps others to see the most helpful information.