Get distance from one AI to other AI


I implemented the get distance to player controller with no problems, but i’m trying to do the same with another AI character and i can’t find the solution.
I need to get the distance from one AI to other(s) AI… how i can do that?

Thanks in advance.

The locations of the AI would be represented as Vectors, you can simply use Vector Subtraction and get the length of the resulting Vector as the distance between the 2 points.

It probably is for this usecase, but i usually forget that there is nice helper functions like that in UE4 :stuck_out_tongue: Not to mention, if he wanted to extend his functionality to include just random points, GetDistanceTo would then be useless as it only deals with Actors. Im pretty sure GetDistanceTo is just a condensed version of what i described above anyhow.

Just to add: the resulting vector - vector distance would be a float, if you want to store it as a variable.

Thank you guys, using vectors I solved my problem!