AI Character In Player Camera View or not?

Does anyone know if it is possible in blue prints to know if a character is in the camera view or not. Basically I would like to know if an AI Bot is being looked at or not being looked at by the player. Appreciate any help or direction with this one cheers in advance…

This is interesting because of many things might affect what you defined as visible or not.

  1. AI capsule count as AI itself? or just the visible mesh? ( you may see part of capsule but not see the mesh)
  2. what if AI got blocked partially by scene object? ( make trace harder )
  3. what if AI are blocked by foliage, you can still view the rough shape but already broken into tiny pieces across screen.( make trace very hard)
  4. what if AI are blocked by semi transparent objects?(fence, smoked glass, undefined behavior and not trace friendly)
  5. if AI try to detect if my cursor hover around them, player can always use peripheral view(border of screen) to avoid detection.

Seems to me a valid way to check is to render some secondary pass where everything that blocks view will render black, and AI will render say Red.
Then given a threshold and maybe some post processing, to decide if AI is visible to player or not.
And this method probably is not a blueprint discussion.

Cheers For the reply. I was just think about having an AI move towards you if looking away and staying put if looking at + id use it in an empty room just was cuorious if it could be done and in BPs but thanks for clearing this up sounds probably too technical for my level but again appreciate the reply

you should use tracing to get this things.

for example, you can check, is bot on the screen, and if yes, trace line from player’s eyes to bot eyes.
if trace is hit bot, you know that he is visible, if not - maybe not )

I’d steer clear of line tracing for this. Its too easy to hit edge cases where you are blocked by an object at the trace but still have vision for most of the character.

To the OP, I think there’s a “cone vision” thing in the BT toolset already. If you look at the available decorators it should be in there.

wow cheers for the reply’s guys… ill take a look zoombapup at the cone thing …cheers again