Tweak some numbers

This commit is contained in:
Guillaume Meunier
2025-11-08 11:15:46 +01:00
parent 0ffd998896
commit 39d50479b1
2 changed files with 10 additions and 6 deletions
+5 -4
View File
@@ -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;
+5 -2
View File
@@ -237,7 +237,10 @@ std::vector<std::pair<ImVec2, float>> 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::controller_state> 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;
}
}