0 votes

When the player on the scene enters the enemy's field of vision, the enemy is following her. but even if there is a wall between the player and the enemy, the enemy notices the player. How do I make sure that my enemy does not see the player when a static object enters between the player and the enemy?
(My scene is 3d and there is an area from the enemy, it can see its 360 degree view.)

Godot version 3.2.3
in Engine by (53 points)
edited by

have you tried using a raycast ? It's a good way of checking if there's wall in front of your agent

but raycast only works for one way and I use area. I don't know how to do it with raycast.

1 Answer

0 votes

You can use both an area and a raycast. When the player enters the area, cast a raycast to the player to see if there's a wall in the way. Continually check to see if the player has gone behind a wall by updating the raycast's end point.

by (7,336 points)

the enemy's angle of view is 360 degrees. Shouldn't I use a lot of raycast for this? Could you please give me an idea or an example?

Sorry, I don't really do 3D. But you only need one area and one raycast. Just move the one raycast's end point around.

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 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 webmaster@godotengine.org with your username.