b3d-radar

A radar sensor you attach to a platform (an aircraft, a turret). It enumerates the scene's radar-blips, detects those in range · profile and inside its cone, and acquires locks on the nearest opposed contacts — all via the pure, tested radar model. Nest it in the thing it rides:

b3dAircraft({ player: true, y: 0 },
  b3dRadar({ range: 250, coneDeg: 90, lockTime: 1.5, maxLocks: 2 }))

The platform reads radar.tracks (to plot the HUD) and radar.nearestLock (a homing missile's target — no lock ⇒ the missile flies ballistic). A turret wants a cheap one: maxLocks: 1, alignment: 'hostile' (so it only locks the player).

Attributes

Attribute Default Description
range 250 Nominal range — a profile 1 blip is detected within this.
coneDeg 90 Detection cone HALF-angle (deg). 90 = front hemisphere.
lockTime 1.5 Seconds of continuous detection to acquire a lock (0 = instant).
maxLocks 2 Max simultaneous locks (the nearest opposed contacts).
alignment 'friendly' This radar's own faction. It locks only opposed blips (friendly⇄hostile); neutrals/waypoints show but never lock.
updateInterval 100 Radar refresh period (ms). Runs below frame-rate and is dithered across frames so many radars don't all recompute the same frame.