fix: line_of_sight_exists returns false if detector is not in world
This commit is contained in:
parent
50b68f1fb1
commit
300cac9dd3
1 changed files with 3 additions and 0 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue