# Object Tracking

[Object Tracking](https://docs.multiset.ai/multiset-quest-sdk/sample-scenes/object-tracking) scene demonstrates real-time object detection and tracking using the Quest SDK's `ObjectTrackingManager`. This scene captures a single camera frame to identify and track pre-scanned objects in the environment, applying pose estimation to align virtual content with physical objects.

This scene uses a single camera frame per tracking request, enabling quick object detection and continuous background tracking to maintain alignment.

### Core Components

The scene includes the following key GameObjects:

* **MultisetSdkManager** — Handles SDK authentication and initialization.
* **ObjectTrackingManager** — Manages the object tracking process.
* **ObjectSpace** — Parent GameObject for tracked object containers. Each tracked object gets its own child container automatically.

<figure><img src="https://3163433004-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FokTDI7QVY04Zvb1pQ8Ry%2Fuploads%2FeWrOXDwbVq7oiDcKVb8m%2FScreenshot%202026-03-31%20at%202.56.14%E2%80%AFPM.png?alt=media&#x26;token=2977992e-e0b5-4543-8f73-45c68cd9e3bb" alt=""><figcaption></figcaption></figure>

### ObjectTrackingManager Properties

| Property                    | Type       | Default | Description                                                                                                    |
| --------------------------- | ---------- | ------- | -------------------------------------------------------------------------------------------------------------- |
| `objectCodes`               | `string[]` | `[]`    | Array of object codes to track. Maximum 10 codes allowed. Obtain codes from the MultiSet Developer Portal.     |
| `autoTracking`              | `bool`     | `true`  | If true, object tracking starts automatically after SDK authentication.                                        |
| `backgroundTracking`        | `bool`     | `true`  | When enabled, the manager periodically sends tracking requests in the background to maintain object alignment. |
| `bgTrackingDuration`        | `float`    | `15`    | Time interval in seconds between background tracking attempts. Valid range: **5–30 seconds**.                  |
| `restartTracking`           | `bool`     | `true`  | If true, the manager re-tracks objects automatically when AR tracking is lost.                                 |
| `confidenceCheck`           | `bool`     | `true`  | When enabled, only tracking results with a confidence score above the threshold are accepted.                  |
| `_confidenceThreshold`      | `float`    | `0.3`   | Minimum confidence score required for a tracking result to be valid. Valid range: **0.2–0.8**.                 |
| `showAlert`                 | `bool`     | `true`  | If true, a toast message is displayed on tracking success or failure.                                          |
| `firstTrackingUntilSuccess` | `bool`     | `true`  | When enabled, the first tracking request retries silently until it succeeds without showing failure messages.  |

### Object Tracking Callbacks

| Callback                  | Description                                                                        |
| ------------------------- | ---------------------------------------------------------------------------------- |
| `ObjectTrackingInit`      | Invoked when the tracking process is initiated by calling `StartObjectTracking()`. |
| `ObjectTrackingRequested` | Invoked just before the captured frame is sent to the MultiSet API.                |
| `ObjectTrackingSuccess`   | Invoked when an object has been successfully tracked and its pose is applied.      |
| `ObjectTrackingFailure`   | Invoked when the tracking process fails (e.g., no object found, network error).    |

### Public Methods

**StartObjectTracking()**

Manually starts the object tracking process.

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

Calling this method captures a single frame from the Quest passthrough camera and sends it to the MultiSet backend for object detection and pose estimation. Use this if `autoTracking` is disabled and you want to trigger tracking manually.

### Setup

1. Open the **ObjectTracking** scene from the imported samples.
2. Select the **MultisetSdkManager** GameObject and configure your API credentials.
3. Select the **ObjectTrackingManager** component and enter your **Object Codes** (up to 10).
4. Assign the **ObjectSpace** GameObject where tracked objects will be placed.
5. Adjust tracking settings (`confidenceCheck`, `bgTrackingDuration`) based on your needs.
6. Build and deploy to your Meta Quest device.
