From f20b5f0b499eba33c1c92e93552da03db7cf41e5 Mon Sep 17 00:00:00 2001 From: anomaluridae Date: Mon, 9 Aug 2021 16:48:49 -0700 Subject: [PATCH] make scene interaction be targeted exactly on mining blocks (removing abnormal Empty labels), and don't reset position to None in the middle of mining. --- voxygen/src/session/mod.rs | 5 +---- voxygen/src/session/target.rs | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/voxygen/src/session/mod.rs b/voxygen/src/session/mod.rs index bb1fc6e761..f279b92619 100644 --- a/voxygen/src/session/mod.rs +++ b/voxygen/src/session/mod.rs @@ -436,15 +436,12 @@ impl PlayState for SessionState { build_target.map(|bt| self.scene.set_select_pos(Some(bt.position_int()))); } else { self.scene.set_select_pos(None); + self.inputs.select_pos = entity_target.map(|et| et.position()); } // Throw out distance info, it will be useful in the future self.target_entity = entity_target.and_then(Target::entity); - // controller only wants 1 target - // set default using entity_target as the selected_pos, and update per event - self.inputs.select_pos = entity_target.map(|et| et.position()); - macro_rules! entity_event_handler { ($input: expr, $pressed: expr) => { let mut client = self.client.borrow_mut(); diff --git a/voxygen/src/session/target.rs b/voxygen/src/session/target.rs index 8ee3d67b87..f311954d00 100644 --- a/voxygen/src/session/target.rs +++ b/voxygen/src/session/target.rs @@ -106,7 +106,7 @@ pub(super) fn targets_under_cursor( Ok(Some(_)) if player_cylinder.min_distance(*cam_pos + *cam_dir * (cam_dist + 0.01)) <= MAX_PICKUP_RANGE ) { ( - Some(*cam_pos + *cam_dir * (cam_dist + 0.01)), + Some(*cam_pos + *cam_dir * cam_dist), Some(*cam_pos + *cam_dir * (cam_dist - 0.01)), cam_ray ) @@ -129,7 +129,7 @@ pub(super) fn targets_under_cursor( (d, Ok(Some(_))) => Some(d), _ => None, }).min_by(|d1, d2| d1.partial_cmp(d2).unwrap()) - .unwrap_or(MAX_TARGET_RANGE); + .unwrap_or(MAX_PICKUP_RANGE); // See if ray hits entities // Currently treated as spheres