Is there a way to set a different trace channel for pawn sensing sight?

Hello, i’m using pawn sensing component so that the enemies follow the player when they see him. If they can’t see it they go into search mode. The problem is that if i have multiple enemies following the player, the ones that are closest to the player block the visibility for the the ones in the back so they go into search mode, is there a way to set our own custom trace channel for the pawn sensing to use or define a list of pawn types to ignore? I’ve looked at the source code and i don’t think it’s possible as is, if that’s the case what can do to avoid that besides creating my own pawn sensing logic?

//Edit: Better Solution below

There are multiple possible solutions, but I’d go with the following:

  1. Create an interface called BPI_Player or BPI_Target
  2. Add a MultiSphereTrace to each AI actor searching for pawns. Starting and End point should be the location of the AI actor. If the trace does not work, add 0.1 to the z element on the End vector, although that bug should’ve been fixed by now…
  3. Loop though each hit result and test if the hit actor implements the interface from step 1. If he does you have a valid target and can use the hit location vector as target position.

This is the same solution I use on my player character to search for visible targets. Keep in mind however that you need to run this algorithm on some kind of tick. You can either use a timer, or move the logic into a component and reduce the ticking rate (0.1 or 0.2 seconds should be enough)


This is probably the better Solution: Or the other solution could call GetPlayerController()GetControlledPawn()GetActorLocation(). This is probably better since it doesn’t involve a trace, however you’d still need to run it periodically though.

I ended up doing my own pawn sensing and it’s working :slight_smile: