Skip to content

AntiAirHUD

SOP-PI edited this page May 23, 2026 · 1 revision

Required Inputs

Script Targets (Unity GameObjects/Components)

vehicleObject - The vehicle GameObject that has this HUD system

targetObject - UI transform for the aiming reticle/crosshair

infoObject - UI transform containing target information panel

lineImage - UI RectTransform for connection line (currently unused)

canvas - The canvas GameObject containing the UI elements

Data Container Parameters

calibrationSpeed (string/number) - Projectile velocity in m/s (e.g., "800" for 800 m/s)

calibrationGravity (string/number) - Gravity multiplier (e.g., "1" for standard gravity, "0" for no drop)

UI Structure Requirements

The infoObject must contain child objects:

"Name" - Text component to display target vehicle name

"Distance" - Text component to display distance to target

"Velocity" - Text component to display target speed

Parameter Details

Parameter Type Purpose

calibrationSpeed Number Sets the muzzle velocity of your weapon's projectiles. Higher = faster projectiles = less lead needed

calibrationGravity Number Gravity multiplier for projectile drop. 0 = no drop (lasers), 1 = normal gravity, >1 = more drop

vehicleObject GameObject The vehicle using this HUD (needed to get Vehicle component and position)

targetObject Transform UI element that shows where to aim (lead indicator)

infoObject Transform UI panel showing target name, distance, and velocity

canvas GameObject Parent canvas (currently stored but not used)

Core Functionality:

Target Locking - Press 'G' to lock onto nearest enemy vehicle within 25° of camera center

Lead Calculation - Calculates where to aim based on:

Target velocity

Projectile speed

Gravity drop

Distance to target

HUD Display - Shows:

Lead indicator (where to shoot)

Target name

Distance in meters

Target velocity in m/s

Auto-Update - Tracks locked target position and updates lead indicator in real-time

Team Filtering - Only locks onto enemy vehicles (different team than player)

Behavior:

Automatically updates vehicle list when vehicles spawn/die

Hides UI when not locked or player exits vehicle

Scales reticle size based on distance (smaller at range)

Checks line-of-sight before locking