Ignore self during Pathfinding

I have around a dozen seekers that are using a grid graph to dynamically avoid each other while they move around. The problem I’m having is that the seekers consider their own collider during pathfinding, which sometimes causes erratic movement if I call UpdateGraphs() frequently enough. Is there some way to have each seeker ignore its own collider when creating the path?

I know that I can use the Mask to ignore colliders on a certain layer, but it seems that would require creating a separate graph for each seeker.

If you only have a dozen seekers (more specifically less than 31) you can update the graph with a tag for each seeker and make sure all seekers avoid all tags but their own. See http://arongranberg.com/astar/docs/tags.php

Thanks, I will look into setting that up. I thought that tags were only for static areas, not for dynamically moving colliders.

If I didn’t want to be limited to 31 tags, what would the next best option be?

I don’t see any way to associate a tag with a collider. How does that work?

You cannot associate a collider with a tag, you would have to use a GraphUpdateScene component (or a GraphUpdateObject) directly.

If you had more than 31 objects then I guess one solution is to increase the number of possible tags (which is not that hard). Or you would have to do it the slow way, i.e before every path request you update the graph to make it suitable for the current actor. This would probably kill performance though.

What I suggest is that you instead apply a large penalty below the actor, that way actors can walk through other actors, but only if absolutely necessary.
You can also use some kind of local avoidance system.

I’ve implemented this as suggested, using a GraphSceneObject. Several times a second, I tag the area around each object’s current position, and untag their previous position.

This seems to be working fine on my desktop, but I run into problems on the iPad with lots of these warnings:
“Canceled path because a new one was requested.”

Should this code be reasonably performant on an iPad? I have 5 objects which call it 5 times a second, so 25 executions a second.
`protected void tagPosition(int tagId, Vector2 oldPosition, Vector2 newPosition) {
// Move to the old position and untag it
transform.position = oldPosition;
_graphUpdateScene.setTag = 0;
_graphUpdateScene.Apply();

    // Move to our target's new position
    transform.position = newPosition;
    _graphUpdateScene.setTag = tagId;
    _graphUpdateScene.Apply();

}`

Hey Dozer, just wanted to comment on this thread as I was trying to do something similar to you yesterday but failed miserably. I ended up adjusting the DynamicGridObstacle settings error margin (Update Error) so that it would give a bit of a delay in setting unwalkable nodes. It isn’t super ideal, but it doesn’t seem to be affecting the seekers nearly as much as it does if you just go with the default settings.