Skip to content

Commit

Permalink
distance-independent crosshair size
Browse files Browse the repository at this point in the history
  • Loading branch information
kayhhh committed Sep 4, 2024
1 parent a5f304e commit 3c9c411
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/unavi-player/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pub fn read_keyboard_input(
}

const RAYCAST_DISTANCE: f32 = 5.0;
const CROSSHAIR_RADIUS: f32 = 0.006;
const CROSSHAIR_RADIUS: f32 = 0.012;

pub fn handle_raycast_input(
camera: Query<&GlobalTransform, With<PlayerCamera>>,
Expand Down Expand Up @@ -98,9 +98,9 @@ pub fn handle_raycast_input(
// TODO: Showing double on non-60hz monitors
if let Ok(normal) = Dir3::from_xyz(hit.normal.x, hit.normal.y, hit.normal.z) {
gizmos.circle(
translation + direction * hit.time_of_impact,
translation + direction * (hit.time_of_impact - 0.001),
normal,
CROSSHAIR_RADIUS,
CROSSHAIR_RADIUS * (hit.time_of_impact / RAYCAST_DISTANCE),
Color::WHITE,
);
}
Expand Down

0 comments on commit 3c9c411

Please sign in to comment.