The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

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:

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.

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.