From 39d50479b1d38508c7cb92f0c3f486730c462679 Mon Sep 17 00:00:00 2001 From: Guillaume Meunier Date: Sat, 8 Nov 2025 11:02:35 +0100 Subject: [PATCH] Tweak some numbers --- client/constants.h | 9 +++++---- client/render/imgui_impl.cpp | 7 +++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/client/constants.h b/client/constants.h index 7b58c775..9a29d1c4 100644 --- a/client/constants.h +++ b/client/constants.h @@ -27,7 +27,7 @@ namespace constants::gui { // Minimum distance between a GUI layer and a fingertip/controller to register a click -constexpr float min_pointer_distance = -0.02; +constexpr float min_controller_distance = -0.02; // Font to use (desktop only) constexpr const char font_name[] = "Noto Sans"; @@ -43,9 +43,10 @@ constexpr float scroll_ratio = 10; constexpr float trigger_click_thd = 0.8; // Thresholds on the distance between the fingertip and GUI layers (positive: in front of the GUI, negative: behind the GUI) -constexpr float fingertip_distance_hovering_thd = 0.15; // Max distance to have the cursor hovering -constexpr float fingertip_distance_touching_thd = -0.01; // Max distance to register a click -constexpr float fingertip_distance_stick_thd = -0.02; // Max distance where the fingertip is moved to be on the GUI +constexpr float fingertip_distance_hovering_thd = 0.15; // Max distance to have the cursor hovering +constexpr float fingertip_distance_touching_thd_hi = -0.01; // Distance to register a click +constexpr float fingertip_distance_touching_thd_lo = -0.15; // Distance to register a click +constexpr float fingertip_distance_stick_thd = -0.02; // Max distance where the fingertip is moved to be on the GUI // Minimum scroll value to enable a controller constexpr float scroll_value_thd = 0.01; diff --git a/client/render/imgui_impl.cpp b/client/render/imgui_impl.cpp index 35af95ce..ea193387 100644 --- a/client/render/imgui_impl.cpp +++ b/client/render/imgui_impl.cpp @@ -237,7 +237,10 @@ std::vector> imgui_context::ray_plane_intersection(cons // => ray_start.z + distance × ray_dir.z = 0 float distance = -ray_start.z / ray_dir.z; - if (distance < constants::gui::min_pointer_distance) + if (distance < constants::gui::min_controller_distance and in.source == ImGuiMouseSource_VRController) + continue; + + if (distance < constants::gui::fingertip_distance_touching_thd_lo and in.source == ImGuiMouseSource_VRHandTracking) continue; coord.x = ray_start.x + distance * ray_dir.x; @@ -625,7 +628,7 @@ std::vector imgui_context::read_controllers_sta if (state.hover_distance < constants::gui::fingertip_distance_hovering_thd) state.fingertip_hovering = true; - if (state.hover_distance < constants::gui::fingertip_distance_touching_thd) + if (state.hover_distance < constants::gui::fingertip_distance_touching_thd_hi and state.hover_distance > constants::gui::fingertip_distance_touching_thd_lo) state.fingertip_touching = true; } }