Vehicle Weapons
The Weapons component provides key weapon functionality to a vehicle, and a vehicle should have this component added to the root transform.
Accessing Gun/Missile Weapons
The Weapons component gets all the weapons on the vehicle at the start as well as any loaded onto the vehicle during gameplay and stores them in the Gun Weapons and Missile Weapons lists. You can access them like so.
Selected Target
The Weapons Target Selector is the target selector that defines the target for gun lead target calculations and missile locking, and also defines the target that an AI will attack.
Set it in the inspector of the Weapons component.
You can access the selected target on the Weapons component like so:
Turrets
The Weapons component accesses and stores all the turrets on the vehicle and aims them at the Turret Target Transform defined in the inspector.
With the Turrets Mode setting, you can define how turrets on the vehicle are handled:
Independent - the turret is left to its own devices to acquire targets and fire at them
Manual - the turret is aimed and fired by the vehicle
Auto - the turret target is provided by the Weapons Target Selector but it decides when to fire
Lead Target Positions
When a target is moving very fast across the line of sight, projectile weapons must be aimed ahead of it to hit it. Exactly where to aim is calculated as the lead target position. You can access the lead target information on the Weapons component like so:
Last updated