Determining if the player pawn's camera view is looking at the advancing AI

Hey all,

I’ve been working with the Pawn Sensing configuration for AI in a game I’m working on, and have run into a bit of a snag. I’ve configured the AI to chase my character when he sees him, and have been able to modify the AI’s “Max Walk Speed” based upon the distance from the Player. What I would like to do is add an additional set of code so that if the Player’s camera/POV is looking at the advancing AI, the AI will act differently.

Here’s my code so far:

Right now, it is triggering and I’m getting the text pop-up saying “SIGHT” whenever the AI sees my character, however, I also see the message when I turn my back to it and I can’t see it.

I believe that if there is a camera configuration I could replace the “Get Player Controller” node with, it would work, but for the life of me, I cannot currently find one. Is there something you can think of that would accomplish what I’m looking to do?

Thanks, in advance!


I’ve never used “Line of Sight to” myself but after a little research I see it doesn’t actually check to see if your CAMERA can see the object, it just checks if there’s a path from one object to another. So you’ll get “SIGHT” only if there’s nothing between you and the object.

You could try the “Was rendered recently” ( node which sounds promising, though I’ll admit I’ve never used it.

That does sound promising, thanks! I’ll give it a try, and report back!

Thanks, sir. Again you’ve gone above and beyond!

(I just spent hours recreating the AI code that I found in the documentation, only to find the “Pawn Sensing” code was about three nodes on a tree to get what I wanted. Dang it. Ah well, live and learn!)

Thanks again!


Promises, AND DELIVERS!!!

When I engaged it, it showed “OUT OF SIGHT” in status whenever the AI was offscreen, and “IN SIGHT” when I could visibly see the AI on screen! It worked PERFECTLY, sir, thanks again!

…now, onto other portions of the game!