use palm for close/far threshold
This commit is contained in:
+1
-1
@@ -43,7 +43,7 @@ constexpr float scroll_ratio = 10;
|
|||||||
constexpr float trigger_click_thd = 0.8;
|
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)
|
// Thresholds on the distance between the fingertip and GUI layers (positive: in front of the GUI, negative: behind the GUI)
|
||||||
constexpr float fingertip_distance_close_thd = 0.15; // Distance to switch between touch and aim interaction
|
constexpr float palm_distance_close_thd = 0.20; // Distance to switch between touch and aim interaction
|
||||||
constexpr float fingertip_distance_touching_thd_hi = -0.01; // Distance to register a click
|
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_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
|
constexpr float fingertip_distance_stick_thd = -0.02; // Max distance where the fingertip is moved to be on the GUI
|
||||||
|
|||||||
@@ -581,10 +581,23 @@ std::vector<imgui_context::controller_state> imgui_context::read_controllers_sta
|
|||||||
}
|
}
|
||||||
compute_pointer_position(state);
|
compute_pointer_position(state);
|
||||||
|
|
||||||
if (state.hover_distance < constants::gui::fingertip_distance_close_thd)
|
XrHandJointLocationEXT & palm = (*joints)[XR_HAND_JOINT_PALM_EXT].first;
|
||||||
aim_interaction[ctrl.index] = false;
|
if (palm.locationFlags & XR_SPACE_LOCATION_POSITION_VALID_BIT)
|
||||||
else
|
{
|
||||||
state.pointer_position.reset();
|
controller_state palm_state{
|
||||||
|
.aim_position = {
|
||||||
|
palm.pose.position.x,
|
||||||
|
palm.pose.position.y,
|
||||||
|
palm.pose.position.z,
|
||||||
|
},
|
||||||
|
.source = ImGuiMouseSource_VRHandTracking,
|
||||||
|
};
|
||||||
|
compute_pointer_position(palm_state);
|
||||||
|
if (palm_state.hover_distance < constants::gui::palm_distance_close_thd)
|
||||||
|
aim_interaction[ctrl.index] = false;
|
||||||
|
else
|
||||||
|
state.pointer_position.reset();
|
||||||
|
}
|
||||||
|
|
||||||
if (state.hover_distance < constants::gui::fingertip_distance_touching_thd_hi and state.hover_distance > constants::gui::fingertip_distance_touching_thd_lo)
|
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;
|
state.fingertip_touching = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user