How to get closest pawn in blueprint?

How to get closet pawn using locations in blueprint

ops! yes closest.

Do you mean “closest”?

I’m afraid there’s no single BP node doing that. Currently you’d need to call Get All Actors of Class with Actor Class set to Pawn and just iterate over all received items and pick the closest one. If you wanted to use this information in BT you should use EQS which will make this a lot easier for you.

Cheers,

–mieszko

If you are going to have a lot of actors then I would suggest a sphere overlap check first. That will return the actors within a certain radius from your pawn. Then you can do distance measurements to get the closest one.

Hi Mileszko!
I have Tried using EQS and it is supper easy. now I am able to make AI bot follow the player but bots are not chasing each other.
Thanks!

Hi Justin,
Thanks for the reply. I have tried using sphere trace but its finding closest enemy only once.