MotionTrackingProvider

Provides motion tracking data. For usage details, refer to DataProvider.

You can request a specific number of motion trackers using start with MotionTrackingStartInfo, and receive the result via addRequestCompleteListener. Below is a code sample:

val startInfo = MotionTrackingStartInfo.Builder().apply {
// Request two motion trackers
requestDeviceCount = 2
}.build()
MotionTrackingProvider.addRequestCompleteListener(MotionTrackingProvider.TrackerRequestCompleteListener {
// Get tracker IDs
it.ids
// Check if the number of trackers is enough
if (it.ids.size < 2) {
// May notice the user and request again
} else {
// Save the IDs for use after the callback
}
})
MotionTrackingProvider.start(startInfo)

Motion tracking data contains a list of tracker poses. Each tracker has 6DoF data. You can get all poses via MotionTrackingData.poses or get the pose of a specific tracker by ID using MotionTrackingData.get. Below is a code sample:

// 'ids' is obtained from the request complete listener
ids.forEach {
// Get each tracker's pose
val pose = motionTrackingData[it]
pose.position
pose.rotation
}

See also

Types

Link copied to clipboard

Listener for receiving battery information updates from motion trackers.

Link copied to clipboard

Listener for receiving connection information updates from motion trackers.

Link copied to clipboard

Listener for receiving key events from motion trackers.

Link copied to clipboard

Listener for receiving completion events when tracker pairing is done.

Functions

Link copied to clipboard

Adds the TrackerBatteryInfoListener to receive the battery information of the motion tracker.

Link copied to clipboard

Adds the TrackerConnectionInfoListener to receive the connection information of the motion tracker.

Link copied to clipboard

Adds the TrackerKeyEventListener to receive key events from the motion tracker.

Link copied to clipboard

Adds the TrackerRequestCompleteListener to receive notifications when a tracker request completes.

Link copied to clipboard

Removes the TrackerBatteryInfoListener to stop receiving the battery information of the motion tracker.

Link copied to clipboard

Removes the TrackerConnectionInfoListener to stop receiving the connection information of the motion tracker.

Link copied to clipboard

Removes the TrackerKeyEventListener to stop receiving key events from the motion tracker.

Link copied to clipboard

Removes the TrackerRequestCompleteListener to stop receiving notifications about tracker request completion.

Link copied to clipboard

Starts providing motion tracking data using the specified MotionTrackingStartInfo.