Seeker walks on unwalkable nodes / does not attempt to leave unwalkable nodes

I’m using the “Seeker” script, “AIPath” script, and “Dynamic Grid Obstacle” script that come with the plugin.

In one scene, everything is working perfectly. I have 5 seekers and 1 dynamic grid obstacle. I can move the obstacle around, and watch the graph update accordingly. The 5 seekers all update their paths and move around the obstacle to reach their target. If their target is inside of the obstacle, the seekers move to the nearest walkable node. If the obstacle is placed on top of the seekers, the seekers move outside of the obstacle’s radius. Perfect behavior! Exactly what I want! However…

In another scene, everything is broken. I have 1 seeker and 1 dynamic grid obstacle. The graph updates when I move the obstacle. Normally, the seeker pathfinds around the obstacle. However, if the seeker’s target is inside of the obstacle, the seeker just travels in a straight line to the target, ignoring the obstacle. If the obstacle is placed on top of the seeker, the seeker remains inside of the obstacle.

I’ve spent at least an hour looking at the differences between the seekers in the first scene and the seekers in the second scene, and I can find NO differences whatsoever. The A* grid is the same, the obstacle is the same, the seeker is the same, the target is the same. Same tags, same layers, same values, same colliders, etc. They are identical, except for having different 2D sprites.

What would cause a seeker to walk around on unwalkable nodes? What would cause a seeker to stay within unwalkable nodes, instead of rushing to get out of them?

Hi

Look at the StartEndModifier on the seeker, if the end point is set to “Original”, it could have that problem.
Also check that no graph is generated on top of the obstacle.
(best way is to just make sure the obstacle is in a layer included in the Grid Graph’s Collision Testing mask).

Thanks for the quick response.

The seeker’s StartEndModifier end point is “ClosestOnNode”.

The AstarPath is only using Collision testing (not Height testing). This means that the Astar grid can’t be on top of the obstacle, right?

The AstarPath only has one layer in its mask (“Obstacle”) and the obstacle is in the “Obstacle” layer.

Can you think of any other reasons why this problem would be occurring?

The one difference between the scene where seekers behave properly, and the scene where seekers behave improperly, is that the objects in these scenes have very different scales. So, I decided to experiment with scale.

The environment, seekers, and obstacles in the “proper” scene were using a scale of (1, 1, 1). I changed the scale of these objects to (10, 10, 10), and increased the node size of the A* grid from “1” to “10”. After this change, the seekers started walking across unwalkable terrain and stopped trying to exit unwalkable terrain.

I was was able to get the “proper” seekers imitate the behavior of the “improper” seekers, and the only factor I changed was the scale of the objects involved. So, it looks like scale has an effect on Seeker behavior.

EDIT: The problem was solved by going into the Settings of the Astar Path script and increasing the size of the “Max Nearest” variable so that the objects would search a wider area to get to the next walkable node, even if they are (or their target is) in an unwalkable node.

In my case, since I increased the scale of everything by a factor of 10, I had to increase “Max Nearest” from 10 to 100.

Great that you managed to solve it.

Is “Max Nearest Distance” 10 per default? I thought I had set it to 100…