There a way to make object follow the closest one?

Godot Version



i have been working on an object that its funtions is to follow var target
but that var only applies to one node,
what way could i make it follow the closest object in a group?

iterate over the nodes in a group. use distance_to go get the distance. whatever node is closest that is the one to follow

1 Like