A* Pathfinding, don't allow obstacle to block target.

Hi there,

I have the A* pathfinding asset, and I am wondering if it’s possible to, when placing obstacles down, that when you try to place one, if it blocks the path to the target, then it won’t let you place it down.

Is there a function, or variable for this?

Thank you.

I haven’t come across a method that will allow you to do it but you can use Path.vectorPath to get the path. The document states that:

Path.vectorPath is a Vector3 list
which holds the path, this list will
be modified if any smoothing is used,
it is the recommended way to get a
path.

Once you have the path you can check if the obstacle you are trying to put lies on that path. If it lies just do not allow to place that obstacle there.