-
A* version: 5.4.6
-
Unity version: 6000.3,10f1.
Hi,
I’m using the Grid Graph. I have road areas in my map, and I want agents to prefer walking on roads instead of grass.
My current setup is:
-
The Grid Graph uses nodes of size
1. -
The road GameObject has a
GraphUpdateScenecomponent. -
Modify Tagis enabled. -
The tag is set to
Road. -
The
Roadtag has a lower traversal cost/penalty for my agents, so they should prefer those nodes.
The issue is that
GraphUpdateSceneshows “No points, using collider.bounds”, so the tag is applied using the collider bounds instead of the actual road shape. Since my road is diagonal/rotated, the bounds cover a rectangular area that includes grass cells around the road. As a result, some grass nodes also get theRoadtag, and agents treat them as preferred road nodes.What I’m looking for is a way to apply the
Roadtag only to the grid cells that are actually occupied by the road shape, not the full bounding rectangle.I was expecting something similar to obstacle/collision behavior on the Grid Graph: obstacles seem to affect walkability per cell based on the cells they actually occupy, instead of applying to the whole collider bounds. Is there a way to get that kind of per-cell behavior when modifying tags?
A few questions:
-
Can
GraphUpdateSceneapply tags based on the actual collider shape instead ofcollider.bounds? -
Would the recommended approach be to update the Grid Graph nodes manually through code based on tile/cell positions?
-
Is there a better workflow for tagging roads on a tile/grid-based map?
Thanks!
-
I remember this coming up a while ago- and I am certainly misremembering some details, but IIRC this isn’t a thing it’s capable of, no.
TBH I’d reccomend just using GraphUpdateScene.points You can update them manually but points works just fine.
Contrary to the previous answer, if you have a reoccurring need for this, then actually, I would do this programmatically. Maybe some kinda RoadGraphHandler thingy.
Thanks! I may be missing something about how GraphUpdateScene.points are supposed to work.
Could you clarify how to make the points define a rotated/diagonal area across the grid? In my case, even when I manually set the points to match the road shape, I still seem to get the same result as when it uses collider.bounds: the tag is applied to the rectangular bounds area, including nearby grass nodes.
Is there a specific setting needed for the points polygon to affect only the nodes inside that polygon, instead of the bounds around it?
Regards.





