# 2D Radar

### Setup

To add 2D radar to a vehicle:

1. Add a **HUD Radar** component anywhere on the vehicle
2. Open the inspector and drag the vehicle's **Tracker** component into the *Trackers* list
3. Set the *Widget Parent* (this is the parent for all the radar widgets that appear to represent targets)
4. Set the *Default Radar Widget*. This must be a prefab with a **HUD Radar Widget** component attached. We'll create them below but for now you can add one from the demos such as the **2DRadarWidget\_Box** prefab
5. Set the *Equator Radius*. This is how far the widgets move from the center of the radar when a target is at maximum radar range (i.e. the size of the 2D radar)
6. Set *Display 2D* to True/checked

Now your 2D radar will display targets.

### Creating 2D Radar Widgets

To create a new 2D radar widget:

1. Create a new game object
2. Add a **HUD Radar Widget** component
3. Add a **UI Color Manager** component
4. Open the inspector of the **HUD Radar Widget** component and drag the **UI Color Manager** you added above into the *Color Manager* field.
5. After creating the visual style of the widget, open the inspector of the **UI Color Manager** component and drag all the images/renderers that make up the widget into their respective lists.&#x20;
6. Drag the widget into the Project tab to create a new prefab
7. Go to any **HUD Radar** component and drag the prefab into the *Default Radar Widget* field (or create an override for a specific target type)

### Zoom

You can control the zoom on a 2D radar using the following code, with reference to the **HUD Radar** component:

```
// Set zoom 0 - 1 (0 is no zoom, 1 is max zoom)
myHUDRadar.SetZoom(someZoomValue);
```
