perf(hud): stop flight instruments redrawing when values have settled

hud_gauge, hud_attitude_indicator, and hud_heading_tape now skip
queue_redraw() when the newly-lerped value hasn't moved past a small
epsilon, instead of redrawing every frame forever. Angle-wrapping
values (heading, attitude roll) use a new shared angle_delta_deg
helper on HudInstrument so the wrap boundary doesn't read as a false
jump.

HUD.tscn's Instruments node now sets process_mode = 1 (PAUSABLE),
overriding the inherited ALWAYS mode from the HUD root so instruments
stop processing during the post-match pause freeze, while sibling
ResultOverlay keeps running its win-screen tween.
This commit is contained in:
Josh Creek
2026-08-04 17:33:52 +01:00
parent fbb783b947
commit bb56f69edc
6 changed files with 36 additions and 9 deletions
+11 -3
View File
@@ -26,11 +26,19 @@ func set_attitude(pitch_deg: float, roll_deg: float) -> void:
_target_roll = roll_deg
# Below this, both axes have visually settled — skip the redraw.
const REDRAW_EPSILON_DEG := 0.05
func _process(delta: float) -> void:
var t := _smoothing_weight(delta)
_pitch = lerpf(_pitch, _target_pitch, t)
_roll = lerp_angle_deg(_roll, _target_roll, t)
queue_redraw()
var new_pitch := lerpf(_pitch, _target_pitch, t)
var new_roll := lerp_angle_deg(_roll, _target_roll, t)
var changed := absf(new_pitch - _pitch) > REDRAW_EPSILON_DEG \
or absf(angle_delta_deg(_roll, new_roll)) > REDRAW_EPSILON_DEG
_pitch = new_pitch
_roll = new_roll
if changed:
queue_redraw()
func _draw() -> void: