the basics of it is that you just need to take the target location and subtract from it the current location, then get the vector length. once you have the length of the vector you can use that as a comparison. for example in the picture below i took two locations and compared to see which was closer to the thirdpersoncharacter. this can also be done with an array of objects and a foreach loop. in the case of the array version you will need another variable to store the current shortest location (see picture 2 for example).