fix: line_of_sight_exists returns false if detector is not in world

This commit is contained in:
Sara Gerretsen 2026-02-12 18:28:39 +01:00
parent 50b68f1fb1
commit 300cac9dd3

View file

@ -73,6 +73,9 @@ void PlayerDetector::_notification(int what) {
// check if there is geometry between detector and player
bool PlayerDetector::line_of_sight_exists() const {
if (!is_inside_world()) {
return false;
}
PhysicsDirectSpaceState3D::RayParameters params{ this->ray_params };
params.from = get_global_position();
params.to = PlayerBody::get_singleton()->get_global_position();