Download

Get closest hole

I have a gopher im putting in my game. I want it to run to the closest hole if the player is close to it.
how do you get the closest hole?
i know it’s a check for distance.

If you have some kind of actor-Hole, you just use the “Get all actor of class” and use a loop :
Get the distance between the gopher and every hole, set a variable to 1000m, if this hole is closer , set this as Target,
Loop all the holes checking if the distance is lower,
at the end you will have your target

Thanks ill try that. But im still a little confused how i get the smallest distance