# How to find the closest character to a target actor using the nav system?

**URL:** <https://forums.unrealengine.com/t/how-to-find-the-closest-character-to-a-target-actor-using-the-nav-system/613156>\
**Category:** AI\
**Tags:** unreal-engine, UE5-0, question\
**Created:** [July 24, 2022, 2:50pm UTC](https://forums.unrealengine.com/t/how-to-find-the-closest-character-to-a-target-actor-using-the-nav-system/613156 "2022-07-24T14:50:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pandoux](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@pandoux](https://forums.unrealengine.com/u/pandoux)\
**Post date:** [July 24, 2022, 2:50pm UTC](https://forums.unrealengine.com/t/how-to-find-the-closest-character-to-a-target-actor-using-the-nav-system/613156/1 "2022-07-24T14:50:13Z")

</div>

Hi,

I am looking for a way to find the closest character to a target actor on the path of the navigation system, i.e I don’t want to use the “GetDistanceTo” method because character may be closer to the target in distance but not on the path. And I can’t either use the “GetCurrentPathIndex” method because characters may be on the same path index.

 ![target](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/1/f/b1fcab3906f86885092bd8ab698fd2afddca5b91.jpeg)

---

<div class="post-metadata">

**Author:** ![dowhilefor](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/dowhilefor/32/552685_2.png) [@dowhilefor](https://forums.unrealengine.com/u/dowhilefor)\
**Post date:** [August 3, 2022, 1:21pm UTC](https://forums.unrealengine.com/t/how-to-find-the-closest-character-to-a-target-actor-using-the-nav-system/613156/2 "2022-08-03T13:21:17Z")

</div>

You could try those, but depending on the amount of tests, that can get expensive quickly.

 ![find_path](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/c/2/bc2edcea7cc8ba9395ae18696fd95ee328037036.png)

In C++ you have access to an asynchronous one for the last one. Which might be your only way, if performance becomes a problem.

---

<div class="post-metadata">

**Author:** ![eblade](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@eblade](https://forums.unrealengine.com/u/eblade)\
**Post date:** [August 6, 2022, 6:39am UTC](https://forums.unrealengine.com/t/how-to-find-the-closest-character-to-a-target-actor-using-the-nav-system/613156/3 "2022-08-06T06:39:04Z")

</div>

I’ve never messed with it, but I do believe that this is what EQS queries are for
