# ObjectTrackingManager

#### Object Tracking Manager

The ObjectTrackingManager enables tracking of real-world objects with the MultiSet Quest SDK. It captures an image from the Quest passthrough camera, sends it to the MultiSet backend for analysis against your specified object codes, and aligns a digital container under the objectSpace GameObject with the position and orientation of the detected object.

#### **Description**

This manager detects and tracks real-world objects that have been pre-configured in the MultiSet system for Object Tracking. You can track up to 10 objects by providing their object codes. Each query returns the matched object code in the response, and the manager creates (or reuses) a child GameObject under objectSpace named after that code, so content for each tracked object stays separate.

The manager supports automatic tracking after authentication, periodic background tracking to keep poses fresh, silent retry of the first request, and confidence-based validation of results. Camera frames are supplied by a frame capture provider, which must be set via `Initialize()` before tracking can run on the device. In the Unity Editor, the manager falls back to simulation data for testing.

A set of UnityEvent callbacks lets other scripts react to each stage of the tracking process, and a C# event provides the full tracking response.

## **Properties**

This section details the publicly accessible fields of the ObjectTrackingManager that can be configured in the Unity Editor or via script.

| Property                  | Type                                  | Description                                                                                                                                                                                     |
| ------------------------- | ------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| objectSpace               | GameObject                            | Assigned in the Inspector. The root GameObject for tracked content. Each tracked object gets its own child container, named after its object code, whose pose is updated on a successful track. |
| objectCodes               | string\[]                             | The object codes to track. A maximum of 10 codes is allowed. Object codes are obtained from the MultiSet developer portal. The response identifies which of the provided objects was matched.   |
| autoTracking              | bool                                  | If set to true, the manager will automatically attempt to start the tracking process as soon as the SDK is authenticated.                                                                       |
| backgroundTracking        | bool                                  | When enabled, the manager will periodically send tracking requests in the background to keep the tracked object's pose up to date.                                                              |
| bgTrackingDuration        | float                                 | The time interval in seconds between background tracking attempts. The value is clamped between 5 and 30 seconds (default: 15).                                                                 |
| restartTracking           | bool                                  | If enabled, the manager will automatically try to re-track the object after AR tracking is lost.                                                                                                |
| confidenceCheck           | bool                                  | When enabled, a tracking result is accepted only if its confidence score is above \_confidenceThreshold. Enabled by default.                                                                    |
| \_confidenceThreshold     | float                                 | The minimum confidence score required for a tracking result to be considered valid when confidenceCheck is enabled. The value is clamped between 0.2 and 0.8 (default: 0.3).                    |
| firstTrackingUntilSuccess | bool                                  | If enabled, the first tracking request retries silently until it succeeds, without showing failure messages.                                                                                    |
| ObjectTrackingInit        | UnityEvent                            | Invoked when the tracking process is initiated by calling StartObjectTracking().                                                                                                                |
| ObjectTrackingRequested   | UnityEvent                            | Invoked just before the captured image is sent to the MultiSet API.                                                                                                                             |
| ObjectTrackingSuccess     | UnityEvent                            | Invoked when an object is successfully tracked and the pose has been applied to its container under objectSpace.                                                                                |
| ObjectTrackingFailure     | UnityEvent                            | Invoked when the tracking process fails (e.g., the object was not found in the frame or a network error occurred).                                                                              |
| OnTrackingWithResponse    | event Action\<ObjectTrackingResponse> | C# event that provides the detailed tracking response, including the matched object code. Subscribe to this from script to access the full response data.                                       |

***

## Methods

This section describes the publicly accessible methods of the ObjectTrackingManager.

**Initialize(IFrameCaptureProvider frameCaptureProvider)**

Sets the frame capture provider used to grab passthrough camera frames.

**Declaration**

```csharp
public void Initialize(IFrameCaptureProvider frameCaptureProvider)
```

**Description**\
The manager needs a frame capture provider before it can capture images on the device. Call this once during scene setup, passing the provider that wraps the Quest passthrough camera. The sample scenes show this wiring.

**StartObjectTracking()**

Manually initiates the object tracking process.

**Declaration**

```csharp
public void StartObjectTracking()
```

**Description**\
Calling this method captures a frame from the passthrough camera and sends it to the MultiSet API along with your object codes. This is the primary method to call if you have autoTracking disabled and want to trigger tracking based on a specific event or user action. If a tracking request is already in progress, the call is ignored.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.multiset.ai/multiset-quest-sdk/api-reference/objecttrackingmanager.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
