Help: How to detect when pawn sensing is not active.

Hi

I would like to know if it is possible to trigger an event if pawn sensing is not active?

This should get you started https://answers.unrealengine.com/questions/129060/pawn-sensing-false.html

Create a bool on your enemy blueprint. I called mine SawPlayer
Event Tick -> Branch and check if the bool is true.
The delay is set to 0.5 because that is the value of the pawnsensing component. Meaning it will only check every half a second.

Then it gets the distance to the player. Get player Pawn is you… the player.
On the left you see components, one of them should be the pawn sensing component. This component has a sight radius.

Basically what you do is compare the distance with the Sight Radius of the Pawn sensing component.
Meaning if the distance is more than the Sight Radius it means the player is no longer seen.

This is a crude form of doing it and is mostly applicable to Platformers. The rest you can ignore as that was something i implemented for my needs.

The important concept to understand is that you need to compare the distance from your enemy to your player, with the enemies pawn sensing radius.

1 Like

Hi

So other then range, there is no way to do it.

So if I run and hide behind the wall, even though I know it is not sensing me, I can not pull that value?

That is a bit of a shame.

Thanks anyhow

No.

The above example is a crude platformer style pawn sensing.
If you want to do something where line of sight is broken, what you can do is cast rays and check if it hits the player.
I saw some cool tutorials on youtube though im not sure if he had a broken line of sight.

Your imagination is your limit. Sort of :stuck_out_tongue:
For example lets say you do a line of sight, and its broken you can get that location where it last saw the player, and make the ai move to that location to investigate etc.

Also… go search answerhub. Some people did what you are trying to do

I havent done line of sight broken by walls etc… but i think casting a single line would be the best approach.

Cheers

Worked out a simple way. Since I am scanning every .1, I put a delay of 2.5 second, and set a Bool to say I can not see pawn.

It it is still in range then .1 later it is rest back. Seems to do job.

Just a timeline issue now arising.

.

i cant see “OnSeePawn” event

You need to add Pawn Sensing Component.:slight_smile: