Also disable far interact if the hand is within 15cm of the window, even if it's out of the arm's reach test. Distance test is now from the intersection point instead of the window origin.
@@ -1799,10 +1799,11 @@ bool32_t _ui_handle_begin(uint64_t id, pose_t &movement, bounds_t handle, bool32
ray_t far_ray = { hierarchy_to_local_point (ptr->ray.pos),
hierarchy_to_local_direction(ptr->ray.dir)};
if (bounds_ray_intersect(box, far_ray, &at)) {
- vec3 window_world = hierarchy_to_world_point(vec3_zero);
+ vec3 window_world = hierarchy_to_world_point(at);
float curr_mag = vec3_magnitude_sq(input_head_pose_world.position - window_world);
+ float hand_dist = vec3_magnitude_sq(hand->palm.position - window_world);
- if (curr_mag < 0.6f * 0.6f) {
+ if (curr_mag < 0.6f * 0.6f || hand_dist < 0.15f * 0.15f) {
// Reset id to zero if we found a window that's within touching distance
ui_focus_set(i, 0, true, 10);
skui_hand[i].ray_discard = true;
