feat: changed distance check < to <=

This commit is contained in:
Sara 2024-06-19 12:05:38 +02:00
parent a946f7f39b
commit 6dddbced43

View file

@ -35,7 +35,7 @@ bool UnitWorldState::get_is_at_target() const {
gd::Vector3 const target = this->target_node->get_global_position(); gd::Vector3 const target = this->target_node->get_global_position();
gd::Vector3 const current = this->parent_unit->get_global_position(); gd::Vector3 const current = this->parent_unit->get_global_position();
float const min_dist = this->agent->get_target_desired_distance(); float const min_dist = this->agent->get_target_desired_distance();
return (target - current).length_squared() < min_dist * min_dist; return (target - current).length_squared() <= min_dist * min_dist;
} }
bool UnitWorldState::get_is_target_dead() const { bool UnitWorldState::get_is_target_dead() const {