A* Pathfinding Project

How to get repath needed AIs because dynamic block?


#1

hello. my goal is 1000 agent count.

for performance, I turned off AiLerp’s ai.canSearch. when search needed(target changed) i set to on.

this works well static map. (1000 agent 400*400 grid map 60fps)

but when I added dynamic obstacles, AIs don’t know repath needed.

need%20repath

in this image, yellow box spawned, aStarPath changed. 4 paths needs repath.

I want to get the list of repath needed AIs .

thank you!!


my CustomAiDestinationSetter

    private void Update()
    {
        if (ai.reachedEndOfPath)
        {
            ai.canSearch = true;
            SetDestination();
        }
        else
        {
            ai.canSearch = false;
        }
    }

    private void SetDestination()
    {
        destination = gameController.OpenSpaces[Random.Range(0, gameController.OpenSpaces.Count)];
        ai.destination = destination;
    }