Target Selectors
Creating Target Selectors
To add a target selector to a vehicle:
Add a Tracker Target Selector component anywhere on the vehicle
Open the inspector and set the Tracker field to the Tracker you added to the vehicle above.
If this target selector is the one used by the weapons, go to the Weapons component on the vehicle and set the Weapons Target Selector to the target selector you just added
Customize the settings in the inspector
Target Selection Input
To set up target selection controls:
Add a new game object under the Player in your scene
Add a PlayerInput_InputSystem_RadarControls component
Now, when the player gets in the vehicle, the targeting controls will work on the target selector defined in the vehicle's Weapons component.
The targeting controls are set up using Unity's Input System. Open the General Input input asset in the Project tab by double clicking it, navigate to the Targeting Controls section, and you'll be able to modify the input bindings there.
Currently, you can choose Next, Previous, Nearest and Front targets. Here are some code snippets you can use if you wish to control the target selector:
Cursor Target Selection
To enable cursor target selection on your vehicle:
Make sure your vehicle has an Aim Controller component on it
Check the Aim Target Selection Enabled checkbox in the inspector
The Aim Controller is discussed in more depth here.
Target Selection For AI
By default, in the demos provided in the kit, the AI uses the target that is selected by the Target Selector that has been assigned to the Weapon component on a vehicle as its combat target.
Last updated