Download

AI Perception Question

After finally getting my patrolling AI working I am now moving to the next step. I am trying to detect whether the ai pawn sees the player and if it does move to the player. The way that I was thinking of accomplishing this was to use the sight sphere that pops up when the ai perception “Sees” an object of interest. Basicly it would move toward that sphere if the pawn loses sight of the player or if still sees the player move to the player. Which the only problem I am having is how do I get the event triggered when the perception system “sees”? Also should these components be placed on the pawn itself or the AI Controller? I am using a behavior tree for my patrolling AI. I apologize if I overlooked these functions in the docs.

There’s an event on the AIPerceptionComponent add one to your AIController and then right click it in the components list and you should see the event. Add that event and it gives you an array of agents that have been sensed.

Is the pawn sensing component still good to use or is it out dated?

Edited:

Also when I run the game the ai perception doesnt detect my player character while runing the level. Currently I am running 4.7 until 4.8 becomes “Finished”. I have everything set up under the ai controller, and the sight sense added under the component. What should I check to see what is causing this issue?

In the AIPerception component under the Sense details there is dropdown titled Detection by Affiliation. There should be three options: Detect Enemies, Detect Neutrals, Detect Friendlies. Try setting them all to true.

I have tried that but wil double check when I get home.

Edited:

Yes all of those flags are set.

After adding a “GetPerceived actors” to my ai controller blueprint my bool variable under my blackboard finaly updates. However I have it running on every tick, and I assume that it this is not exactly the correct way to get when the ai sees the player however without it the perception picks up the player but never fires the OnPerceptionUpdated event. Is there anything that I am doing wrong?

Did you tried to add an aiperceptionstimulisource in your character ? You can find it under “add component” when you edit your blueprint character

has this been solved? cannot get AIperception to see my playing for nothing