How to make pathfinder seeker to return random path?

I have prefab with Seeker script attached to it. Whenever that prefab instantiated seeker.StartPath is called in its Start method. The problem is that each object gets the same path.

My question is:

  1. How to make that each object would get random path from the possible pathes
  2. How to make Pathfinder to find not the shortest but any possible path

can anyone help me?

You may ask directly in [A* Pathfinding project forums][1]. [1]: http://www.arongranberg.com/vanillaforums/

I have done some basic path seeking myself by implementing the A* algorithm. To get a random path, you will need to make modifications to the heuristic function by introducing new rules in selecting the best/next node, by controlling these rules using a random number, you will get random path.

@Chronos, do you know where to change the heuristic function in pathfinder in unity?

You are using A* Pathfinding from arongranberg.com, aren't you? If source codes are included and there are a detailed documentations, you can make modifications to the source code by referring to the comments in the source-code with the documentation.

1 Answer

1

Perhap you can create one manager that seeks path for your object and assigns different ones to each of your objects.

So have 1 manager that finds 5 paths to 5 random positions inside a radius. Assign the 5 paths to your 5 objects.

There might be better ways of doing it, but this is the one I’d go with to start with.

@osmant, I tried to do it, but I cannot figure out how to get all the paths so I could give to each object. Do you know how to get all paths?

@osmant, you just rephrased the OP's question.