Best way for AI to chase player if % visible

I have an AI working that can chase the player when it is seen. However, it will start chasing from the moment the player is in vision and I only want it to start seeing the player if it is (around) 70% visible so the player has a chance of hiding. What’ the best way of doing this?

Hi, generally speaking you could/would overwrite the CanBeSeenFrom function of the IAISightTargetInterface inside the pawn that should be seen. Then inside that function check for how visible the pawn is and set the OutSightStrength accordingly. That OutSightStrenght you set there will then be the StimulusStrenght you get inside the AI perception component.

As for checking “how visible the pawn is”, you could do linetraces to different bones and check whether those hit the pawn and build a score that way.

And you will need C++ for the approach described above, not possible with blueprints.

I’ve fixed it by attaching a child actor which contains a capsulecollider and the perceptionstimuli to my player character instead of attaching the stimuli to my player itself. Thanks for the suggestion though!