Created a AI enemy and he can see me through walls. Is there an option in the behavior tree that says cannot see through walls? In the BT is has, “Move To” and even if the AI is behind a large long wall the AI can see through the wall and will run all the way around and shoot at me.
Thank you for the reply! I checked to make sure there was collision and that it is set to block all, I tried a few different static meshes and they all do the same thing. When you turn on debug you can see the AI come through the wall.
Thank you for the reply! I checked to make sure there was collision and that it is set to block all, I tried a few different static meshes and they all do the same thing. When you turn on debug you can see the AI come through the wall.
Right, but how are you actually setting that player value? It looks like maybe in your AI service?. Because I do not think the AI is actually seeing you, its just moving toward you because that value is set. When AI perceives something it will actually draw a debug sphere on top of what it is perceiving. That green line is just its perception vision angle.
So the issue is either in your AI service or in your AI controller if you are using the On Perception Updated event.
Yes, this is exactly your problem. You need to get rid of this service and do this a different way. The AI is not seeing through the wall, in fact the AI is not seeing you at all. You are just setting the player value every service tick, then you are telling the AI to move to the value that is set (your player).
If you only want the AI to move to you when it see you, then you need to do this in the AI controller. (there is a way to also do it with a service but is more involved).
The AI perception component has an event on it called On Target Perception Updated. This will give you an actor and stimulus that the AI has actually perceived, then you can use that value to set the blackboard key.
Here is a really simple example, but you would probably want to cast the actor to make sure its the player, or do any other checks before setting the value. You will also need to make sure to unset the value as well.
We have to be getting closer I have been working all day on this
Thank you for helping me!
You are right, the player is being set from the AI-Service, does this look correct?
Thank you for the detailed reply! That make sense, I created the changes like you said and then tested and everything looks good except the enemy is blind :0 He has no sight, what do you think could be causing this?
Thank you for all you help Steve! It is working now, the following information also helped.
"By default, AI Perception only detects enemies (actors assigned to a different team). However, actors do not have a team by default. When an actor doesn’t have a team, AI Perception considers it neutral.
As of writing, there isn’t a method to assign teams using Blueprints. Instead, you can just tell AI Perpcetion to detect neutral actors. To do this, expand Detection by Affiliation and enable Detect Neutrals."
I apologize for not getting back to you sooner, I would have mentioned that but I assumed you already had that part setup. But im glad you got it work.