boost interaction distance

This commit is contained in:
yuni 2024-04-17 15:24:00 +02:00
parent a6e6dac3d8
commit 81b09d183a
2 changed files with 2 additions and 2 deletions

View file

@ -6,7 +6,7 @@ use crate::{actor, audio, camera, chat, commands, effects, hud, nature, var, wor
pub const ENGINE_SPEED_FACTOR: f32 = 30.0; pub const ENGINE_SPEED_FACTOR: f32 = 30.0;
const MAX_TRANSMISSION_DISTANCE: f32 = 100.0; const MAX_TRANSMISSION_DISTANCE: f32 = 100.0;
const MAX_INTERACT_DISTANCE: f32 = 40.0; const MAX_INTERACT_DISTANCE: f32 = 50.0;
pub struct ActorPlugin; pub struct ActorPlugin;
impl Plugin for ActorPlugin { impl Plugin for ActorPlugin {

View file

@ -414,10 +414,10 @@ pub fn find_closest_target<TargetSpecifier>(
// not on the player mesh but on the camera, which doesn't have a position. // not on the player mesh but on the camera, which doesn't have a position.
let (angular_diameter, angle, distance) = calc_angular_diameter_known_target_vector( let (angular_diameter, angle, distance) = calc_angular_diameter_known_target_vector(
trans, camera_transform, &target_vector); trans, camera_transform, &target_vector);
let distance_to_surface = distance - trans.scale.x;
if angle <= angular_diameter.clamp(0.001, PI) { if angle <= angular_diameter.clamp(0.001, PI) {
// It's in the field of view! // It's in the field of view!
//commands.entity(entity).insert(IsTargeted); //commands.entity(entity).insert(IsTargeted);
let distance_to_surface = distance - trans.scale.x;
if distance_to_surface < closest_distance { if distance_to_surface < closest_distance {
closest_distance = distance_to_surface; closest_distance = distance_to_surface;
closest_entity = Some(entity); closest_entity = Some(entity);