Trouble with PawnSensing and the SeePawns bool

I’m trying to create an character that will essentially try and ‘see’ the player character and chase after it. I have it so that it will ‘see’ the player and move to the location of the player, but then I’m trying to tell it to go back to location after it loses sight of the player. To do this I am using the SeePawns boolean attached to Pawn Sensing. It always seems to be true and I’m not certain why.

Here is my blueprint that is inside the “Enemy”. Starting location is a Vector that grabs the ‘Enemy’s’ Location with Event.BeginPlay.

It is always true, because it’s a setting of the PawnSensing component that designates whether to look for pawns or not. It’s not an answer to the question whether the sensor senses a pawn at the moment. For checking whether sensor had just seen a pawn you, as far as I understand, should make Gates, Branches and stuff, that OnSeePawn would have leverage in.

This is how I solved the problem. Note that I made Sensing Interval extremely small - 0.001 - so that I don’t get >1 Tick Events between OnSeePawn events.

Hi Emolyptic,
We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.
Thank you.
Sean

The issue is resolved. Sorry I didn’t respond. But the answer did help me fix my problem. Thank you.

Please share what you did to resolve this. It would be very helpful!

Thanks

He said “But the answer did help me fix my problem.”, which, I guess, means that he did what I told to.

Hi there,

sorry to pop this thread up but I encounter the same issue with my pawn sensing. For instance I’m using a turret able to look at some defined moving target.Using gate is not giving me expected results. What I want to achieve is “quite” simple. If the sensor (attached to the turret) can see my pawn then the turret should start its rotation to look at the target. If the target becomes out of the sensor sight (and all related settings of course), then the turret should execute another behavior. The problem is that, as soon as the pawn is seen, the turret will aim at the target, always, and will never stop the aiming process. This is mainly because I branch the aiming execution flow independently to the onSeePawn node because I want a smooth rotation, done in realtime and not being updated by the underlying sensing interval… The problem can be resolved easily if, for example, I extends the SensingComponent and expose to blueprint a method like isPawnSeen(*Pawn) but I wonder if I can use something out of the box…

Also, playing with sensing interval is not really what I want. Putting a very small value will just increase the number of onSeePawn calls. The default value of triggering the event basically each half a second is already good for me and changing this is reallly dependent of what you whant to achieve. For ex: you may want to increase the Event calls if your pawn is very fast and can be out of your sensor scope in less than the default value.

AnimationBlueprint was my first choice as my turret contains bones but it doesn’t contains any animation as I just want to play with basic bones manually but I encounter issues when it’s time to branch the starting ComponentPose to my states, but that’s another story…

So, the question (finally :slight_smile:
Is there a way to “ask” a PawnSensing if a pawn is “actually” being seen?
Adding extra line of sight nodes and checks will just remove the plus-value of using the sensor here…

I’m also interested in this. For eg. I want to know what pawns are around a pawn, so onSensePawn detects pawns that can be seen at close range, but I’m thinking there should be an event for lostSight of a pawn.
As an alternative, I’ve had some success with manual checks for removing already sighted pawns with a timed delegate function that checks distance, angle, and line of sight: Line Of Sight To | Unreal Engine Documentation

But it would be nice if there was something like a lostSight event

Here’s the blueprint implementation for my solution if someone’s interested:

Here is my easy solution.

Each time the OnSeePawn pings it will set the Seen variable boolean to true and trigger a retriggerable delay. As long as the sensing interval on the PawnSensing is less than retriggerable delay the Seen boolean will be true, until the Pawn is out of sight for over the time entered into the retriggerable delay.

1 Like

I spent hours concocting a convoluted method of multiple sphere collisions to sense if the player was within a certain range of the mob to activate it when this simple solution was all I needed to do and it is much better on frame rate. Thank you very much.

Awesome, thanks!