2D Radar
Setup
To add 2D radar to a vehicle:
Add a HUD Radar component anywhere on the vehicle
Open the inspector and drag the vehicle's Tracker component into the Trackers list
Set the Widget Parent (this is the parent for all the radar widgets that appear to represent targets)
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
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)
Set Display 2D to True/checked
Now your 2D radar will display targets.
Creating 2D Radar Widgets
To create a new 2D radar widget:
Create a new game object
Add a HUD Radar Widget component
Add a UI Color Manager component
Open the inspector of the HUD Radar Widget component and drag the UI Color Manager you added above into the Color Manager field.
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.
Drag the widget into the Project tab to create a new prefab
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:
Last updated