From af137b6793a8b6fd51197e42893ef2e31faefe12 Mon Sep 17 00:00:00 2001 From: NexusQuile <104992166+NexusQuile@users.noreply.github.com> Date: Tue, 3 Sep 2024 10:42:47 +0100 Subject: [PATCH 1/2] Add pitch angle aritificial horizon Adds pitch angle to the artifical horizons in the flight HUD --- ui_enhancer/source/scripts/vehicle_hud.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ui_enhancer/source/scripts/vehicle_hud.lua b/ui_enhancer/source/scripts/vehicle_hud.lua index 79f2517..9e611cc 100644 --- a/ui_enhancer/source/scripts/vehicle_hud.lua +++ b/ui_enhancer/source/scripts/vehicle_hud.lua @@ -2049,8 +2049,10 @@ function render_artificial_horizion(screen_w, screen_h, pos, size, vehicle, col) local horizon = artificial_horizon_to_screen(screen_w, screen_h, pos, scale, update_world_to_screen(projected_forward)) update_ui_image_rot(horizon:x(), horizon:y(), atlas_icons.hud_horizon_mid, col, roll) - local angle_step = 10 / 180 * math.pi + local angle_step_deg = 10 + local angle_step = angle_step_deg / 180 * math.pi local steps = math.floor(math.pi * 0.5 / angle_step) + local angle_width = 20 for i = 1, steps do projected_forward = vec3(position:x() + forward_xz:x() * project_dist, position:y() + math.tan(i * angle_step) * project_dist, position:z() + forward_xz:z() * project_dist) @@ -2058,11 +2060,13 @@ function render_artificial_horizion(screen_w, screen_h, pos, size, vehicle, col) if i ~= steps then update_ui_image_rot(horizon:x(), horizon:y(), atlas_icons.hud_horizon_high, col, roll) + update_ui_text(horizon:x()-angle_width/2, horizon:y()-5, math.floor(i*angle_step_deg), 20, 1, col, 0) end projected_forward = vec3(position:x() + forward_xz:x() * project_dist, position:y() - math.tan(i * angle_step) * project_dist, position:z() + forward_xz:z() * project_dist) horizon = artificial_horizon_to_screen(screen_w, screen_h, pos, scale, update_world_to_screen(projected_forward)) update_ui_image_rot(horizon:x(), horizon:y(), atlas_icons.hud_horizon_low, col, roll) + update_ui_text(horizon:x()-angle_width/2, horizon:y()-3, math.floor(-i*angle_step_deg), 20, 1, col, 0) end update_ui_pop_clip() From 7615be5fea29cfad998d5c51dad0b57d507c94d9 Mon Sep 17 00:00:00 2001 From: NexusQuile <104992166+NexusQuile@users.noreply.github.com> Date: Mon, 9 Sep 2024 14:27:18 +0100 Subject: [PATCH 2/2] Update vehicle_hud.lua Moved pitch angle to sides of horizon line --- ui_enhancer/source/scripts/vehicle_hud.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ui_enhancer/source/scripts/vehicle_hud.lua b/ui_enhancer/source/scripts/vehicle_hud.lua index 9e611cc..0150951 100644 --- a/ui_enhancer/source/scripts/vehicle_hud.lua +++ b/ui_enhancer/source/scripts/vehicle_hud.lua @@ -2060,13 +2060,21 @@ function render_artificial_horizion(screen_w, screen_h, pos, size, vehicle, col) if i ~= steps then update_ui_image_rot(horizon:x(), horizon:y(), atlas_icons.hud_horizon_high, col, roll) - update_ui_text(horizon:x()-angle_width/2, horizon:y()-5, math.floor(i*angle_step_deg), 20, 1, col, 0) + --update_ui_text(horizon:x()-angle_width/2, horizon:y()-5, math.floor(i*angle_step_deg), 20, 1, col, 0) + + local hoz_width = 38 + update_ui_text(horizon:x()-angle_width/2-math.floor(hoz_width*math.cos(roll)), horizon:y()-5-math.floor(hoz_width*math.sin(roll)), math.floor(i*angle_step_deg), 20, 1, col, 0) + update_ui_text(horizon:x()-angle_width/2+math.floor(hoz_width*math.cos(roll))+1, horizon:y()-5+math.floor(hoz_width*math.sin(roll)), math.floor(i*angle_step_deg), 20, 1, col, 0) end projected_forward = vec3(position:x() + forward_xz:x() * project_dist, position:y() - math.tan(i * angle_step) * project_dist, position:z() + forward_xz:z() * project_dist) horizon = artificial_horizon_to_screen(screen_w, screen_h, pos, scale, update_world_to_screen(projected_forward)) update_ui_image_rot(horizon:x(), horizon:y(), atlas_icons.hud_horizon_low, col, roll) - update_ui_text(horizon:x()-angle_width/2, horizon:y()-3, math.floor(-i*angle_step_deg), 20, 1, col, 0) + --update_ui_text(horizon:x()-angle_width/2, horizon:y()-3, math.floor(-i*angle_step_deg), 20, 1, col, 0) + + local hoz_width = 41 + update_ui_text(horizon:x()-angle_width/2-math.floor(hoz_width*math.cos(roll)), horizon:y()-3-math.floor(hoz_width*math.sin(roll)), math.floor(-i*angle_step_deg), 20, 1, col, 0) + update_ui_text(horizon:x()-angle_width/2+math.floor(hoz_width*math.cos(roll))+1, horizon:y()-3+math.floor(hoz_width*math.sin(roll)), math.floor(-i*angle_step_deg), 20, 1, col, 0) end update_ui_pop_clip()