Seekers of different sizes

Hello,
If I have seekers ranging from a radius of 1, to a radius of 5, do I have to create a separate layered grid graph for each unique size? I am noticing that my vehicle seekers are slightly overlapping tagged areas that should not be traversable for them, whilst the center of the vehicle is correctly moving along a traversable area.

How do I get the entire seeker, no matter how large, to stay in the traversable area? I did see some previous posts on this topic, but they are mostly 3+ years old. Was wondering if a new approach is now possible.

Hi

Take a look at this tutorial: https://arongranberg.com/astar/docs/multipleagenttypes.html
The easiest way is to create multiple graphs. For grid graphs there is also an option that allows you to use different tags for different agents (also mentioned on the page above). Using tags is less flexible, but it uses a lot less memory.

Note that all graphs in this package follow the principle that the traversable regions of the graph are where the center of the agent should be able to stand. So some other parts of the agent may be in regions that are not traversable, but since the graph has been generated to take that into account, they shouldn’t clip obstacles or anything like that.

1 Like

Thank you for the response and link!

My only concern with this approach is that the tagged nodes from one graph might overlap tagged nodes from another. I did see in the example that the tile sizes have’t been changed from one graph to another though, so fingers crossed that this won’t be the case.

Couple questions about implementation:

  1. Can I still update all graphs by saying: AstarPath.active.UpdateGraphs(guo), or do I need to call each graph separately?

  2. How will adding another graph affect calls that don’t mention which graph to query, such as: AstarPath.active.GetNearest(position, NNConstraint.None)? Does it query all graphs and/or say which graph the node in the response is from?

  3. Is there a way to duplicate a graph rather than adding a new one and copying all the settings over?

  4. Since there is no character radius setting for layered grid graphs, like there is for raycast graphs in the example, I should be setting the Diameter in Collision testing instead, right?

  5. Let’s say I have a vehicle seeker that has a width of 3, length of 11, and height of 4. What settings would you use for a rectangular shape like that?

  6. Does the seeker have to have a Character Controller, or a box collider enough?

  7. “So some other parts of the agent may be in regions that are not traversable” - I have already implemented a test round of adding a second graph, and the seeker still seems to be doing the same thing. Do I need to add colliders to both sides of the traversable path, in order to ‘push’ the seeker completely inside the traversable area?

  1. Yes. You can specify which graphs that will be updated using the guo.nnConstraint.graphMask field, however the default is to update all graphs.
  2. It will query all graphs, you can change which graphs it will query using nnConstraint.graphMask. See https://arongranberg.com/astar/docs/nnconstraint.html#graphMask
  3. Sorry, not at the moment. From a script I suppose you could call AstarData.DeserializeGraphsAdditive in a loop though to get multiple graphs.
  4. Yes. Alternatively you could use the erosion field which also makes them stay away from ledges depending on which behavior your game needs (erosion is also slightly slower than a collision check, especially when updating graphs during runtime).
  5. A rectangular shape cannot be handled as orientation is not considered during pathfinding (doing that requires one node per orientation and knowledge about how the vehicle turns, which is not supported by this package). Best option is to approximate it using a circular shape.
  6. The Seeker doesn’t need to have any collider or character controller at all for pathfinding.
  7. I’m not quite sure what you mean here. Screenshot/video?
1 Like

Wow, thank you for the detailed response! This really helps eliminate a lot of variables (and assumptions I had) in terms of debugging. Setting up a sample scene right now to help demonstrate the issue I am having, trying to get it to work.

Regarding #7, I wanted to clarify a bit more. I quoted the wrong part of the paragraph above. I should have quoted: “So some other parts of the agent may be in regions that are not traversable, but since the graph has been generated to take that into account, they shouldn’t clip obstacles or anything like that.”

Essentially, I think my part of my seeker might be outside the area tagged as traversable for them, because there are no obstacles on the sides of the traversable area, only tagged nodes that shouldn’t be traversable for the seeker. Hence I am guessing that it’s not passing some collider test that would make it stay completely within the traversable area. Example scene should clarify everything shortly :slight_smile: