[Solved]How to check, if there an object between two objects

Hello! The game is some kind of alien shooter, I need to make the follow : if the “Wall” is between “player” and “enemy”, the “enemy” doesn’t strike, and if there are nothing between it, “enemy” strikes “player”. I could try to make a “vision object” and connect to “enemy” and if “vision object” is in collision with "player and is not in collision with “wall” it strikes, but the wall can be behind the player, and it will not work. I tried to compare distances between “Wall” / “enemy”, and “player” /“enemy”, and if the distance between “player” /“enemy” is less, then “enemy” strikes, but it doesn’t work the normal way.
Help please!

Hi, using a raycast is probably the solution for your problem. You can check the Zombie laser example and modify the code to your needs: GDevelop 5

2 Likes

Solved, Thank you a lot !

1 Like