0 votes

Hey there,

So I've been messing around with godot trying to learn as much about the engine functionality as possible before I try making a full-fledged game, and I'm a bit stumped on how to get my enemy AI range finder to respect solid walls.

Here is a gyazo video of what is currently happening: https://i.gyazo.com/7414d819989b27af6a818a480ca7976f.mp4

Ideally, I would not like the enemy to detect players through walls.

The way I am currently making this range finder is by using a circular area2d and detecting if the player enters that region. I'm open to any better ways of accomplishing this as well. https://i.gyazo.com/62ace6b3b28dd82db4eeacca6f42b955.png

Thanks for your help in advance!

Godot version 3.2.3
in Engine by (32 points)

1 Answer

+2 votes
Best answer
  1. Detect player in region
  2. Fire Raycast at player to see if there are any obstructions
  3. If an obstruction is there, continue else if it hits the player do something
by (98 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.