How to recalculate automatically path when nodes set no walkeable?

Hi, please, i have units that walks from point A to point B in patrol mode, some times i create some obstacles between the point A and B, but the units ignore the new no walkeables nodes and try to pass over the new obstacles, some way to say to this units must recalculate the path when obstacle is set in his path? thanks!

PSD: I am using grid nodes

@aron_granberg Please do you can helpme?

He’s on holiday so you may not hear back from him promptly. It sounds like you’re not updating the graph correctly.

https://arongranberg.com/astar/docs/graphupdates.html

The section “Recalculating parts of graphs” may be helpful, you just need to pass it the bounds of the collider attached to your obstacle.

1 Like

image

I’m upgrade correctly the graph, the problem is that when I set a new obstacle, this no triggers the path recalculate, then my units stop when reach the new obstacle, my units no avoid it.

image
There is how looks my update graph (the red cubes)

There is a video with the problem Path Finding Obstacle - YouTube

Hi @aron_granberg , please helpme

I’m certainly no pro with this addon but until the developer returns from their holiday could you not recalculate the paths again just after you recalculate the graph?

I want to avoid recalculate aprox 200 paths each time that I create a new obstacle, when only 5 or 10 paths are affected

Up meanwhile @aron_granberg is back :slight_smile:

Hi

Typically, agents will recalculate their paths regularly enough for this not to be a problem. You may have disabled this.

You can regularly check the seeker.GetCurrentPath().path for any nodes that are unwalkable or destroyed, and in that case issue a path recalculation. This will work for most cases.

The RichAI/FollowerEntity movement scripts will check the paths they are following and automatically recalculate the path if something has changed. The AIPath/AILerp script will not do this, though, since they only follow the points, not the nodes themselves.