> ## Documentation Index
> Fetch the complete documentation index at: https://docs.atlasscripts.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Target

> Entity and zone targeting through a normalized API — resolves to ox_target, qb-target, or the bridge's own Interact.

`Bridge.Target` is a normalized targeting API. You register interactions on **entities**, **models**, or **world zones** with a single option shape, and the bridge dispatches to whatever targeting resource is running — `ox_target`, `qb-target`, or, with neither installed, its own [Interact](/atlas-bridge/developer/world#interact) prompts. Your call site stays the same across all three.

## Availability

Client only.

```lua theme={null}
local id = Bridge.Target.AddBoxZone(opts)
local id = Bridge.Target.AddSphereZone(opts)
local id = Bridge.Target.AddEntity(entity, options)
local id = Bridge.Target.AddModel(models, options)
Bridge.Target.Remove(id)
```

## Provider selection

Target reads its **own** convar — `atlas:target`, not `atlas:ui:target`.

```cfg theme={null}
setr atlas:target "auto"   # auto | ox | qb | own | custom
```

| Value              | Renderer                                                                 |
| ------------------ | ------------------------------------------------------------------------ |
| `auto` *(default)* | `ox_target` started → `ox`; else `qb-target` started → `qb`; else `own`. |
| `ox`               | `ox_target`.                                                             |
| `qb`               | `qb-target`.                                                             |
| `own`              | The bridge's own Interact prompts.                                       |
| `custom`           | Your own resource — fill `editable/target.lua`.                          |

<Warning>
  The bridge's **own** target maps each zone/entity to a single Interact prompt, so it uses only the **first** option you pass, and `AddModel` is a no-op (native Interact cannot target by model). For multi-option targets or model targeting, run `ox_target` or `qb-target`.
</Warning>

## Option shape

Every `Add*` call takes a list of options with this normalized shape:

<ParamField path="options[].label" type="string" required>
  The interaction label shown on the eye/prompt.
</ParamField>

<ParamField path="options[].icon" type="string">
  An icon for the option.
</ParamField>

<ParamField path="options[].distance" type="number" default="2.0">
  Max interaction distance.
</ParamField>

<ParamField path="options[].canInteract" type="function">
  `fun(entity): boolean` — return `false` to hide the option dynamically.
</ParamField>

<ParamField path="options[].onSelect" type="function" required>
  `fun(entity)` — called when the option is chosen. Receives the targeted entity (for `AddEntity` / `AddModel`).
</ParamField>

## Methods

### AddBoxZone

<ParamField path="coords" type="vector3" required>
  Center of the box.
</ParamField>

<ParamField path="size" type="vector3" default="vec3(2,2,2)">
  Box dimensions.
</ParamField>

<ParamField path="heading" type="number" default="0.0">
  Box rotation (honored by ox\_target / qb-target).
</ParamField>

<ParamField path="options" type="table[]" required>
  The interaction options.
</ParamField>

### AddSphereZone

<ParamField path="coords" type="vector3" required>
  Center of the sphere.
</ParamField>

<ParamField path="radius" type="number" default="2.0">
  Sphere radius.
</ParamField>

<ParamField path="options" type="table[]" required>
  The interaction options.
</ParamField>

### AddEntity / AddModel

<ParamField path="entity" type="number">
  For `AddEntity` — the entity handle to attach options to.
</ParamField>

<ParamField path="models" type="string | string[]">
  For `AddModel` — one or more model names (ox\_target / qb-target only).
</ParamField>

<ParamField path="options" type="table[]" required>
  The interaction options.
</ParamField>

### Remove

`Bridge.Target.Remove(id)` — removes a zone/entity registration by the id returned from any `Add*` call.

## Examples

<CodeGroup>
  ```lua Box zone theme={null}
  local id = Bridge.Target.AddBoxZone({
      coords = vec3(25.7, -1347.3, 29.5),
      size = vec3(2.0, 2.0, 2.0),
      heading = 0.0,
      options = {
          { label = 'Rob register', icon = 'cash', distance = 1.5,
            canInteract = function() return canRob end,
            onSelect = function(entity) rob() end },
      },
  })
  -- …later
  Bridge.Target.Remove(id)
  ```

  ```lua Entity theme={null}
  local ped = spawnClerk()
  Bridge.Target.AddEntity(ped, {
      { label = 'Talk', icon = 'comment', onSelect = function(e) talkTo(e) end },
  })
  ```

  ```lua Model (ox_target / qb-target) theme={null}
  Bridge.Target.AddModel({ 'prop_atm_01', 'prop_atm_02' }, {
      { label = 'Use ATM', icon = 'bank', onSelect = function() openAtm() end },
  })
  ```
</CodeGroup>

<Tip>
  When it falls back to the bridge's own Interact, the prompt tints to the player's theme accent like every other component. Install `ox_target` for the richest experience (multi-option, model targeting, box rotation).
</Tip>
