I am using the included AI Path Script in A zombie video game. I am attempting to have lots of zombies on the screen moving towards the target object. Works great except it throws an error after the zombies all reach there location with a buffer over run. If I turn up the re-pathing the zombies are too sluggish to respond. Is there anyway I can get the zombies to only re-path when the target object/changes moves? Would be great if it was just a bit of code to be added to the script(I suspect this is the case) any help would be appreciated.
Doing research into this matter makes it apparent a lot of people look for this functionality. But no answers anywhere.
What do you mean by buffer over run?
You can edit the scripts slightly to get that result, in the AIPath script, keep a variable for the last target point (set it in OnPathComplete to the last element of the vectorPath array of the new path, i.e the last waypoint in the path), then in the TrySearchPath method, simply check if the distance between the new target and the last target are different enough.
I have not added this by default since a lot of people update their graphs and want the character to recalculate the path even when the target has not changed since the graph might have changed. There are also some cases where you might want it, e.g if the character was pushed away from the path or fell off a cliff from an explosion or something.