I’ve got a list of constantly moving GameObjects that each need to determine the closest path to an object in another list of constantly moving GameObjects. When an object needs to select a new target I’m converting one of the GameObject lists into an array of Vector 3 positions and feeding it into
MultiTargetPath. The problem is that
MultiTargetPath sends me to a Vector3 coordinate when what I really need it to do is lock me onto the closest object.
I would love to figure out how to use
MultiTargetPath.Construct to determine the closest object without starting the path, then assigning that GameObject to the
AIDestinationSetter. Because all of the objects are in motion a Vector3 coordinate isn’t useful seconds after I’ve received it—I need to be able to lock onto the closest object.
I’ve tried to pick apart the callbacks in
StartMultiPath to compare the endpoint of the shortest path (which I think is the first path in the list?) with the position of the object in the list and use that comparison to determine the GameObject to target but it feels clunky and prone to error—there’s got to be a better way.
In an ideal world, I would be able to give
MultiTargetPath a list (or an array) of objects, have it determine which one is the closest, and return that object for me to use elsewhere (ie: AIDestinationSetter). I’d appreciate any guidance in how I could get there without altering any code in Seeker.cs or another approach for this functionality.