Can I create a Grid Graph where I only define the Walkable region using Graph Update Scene?

Hi Aaron,

First of all, thank you again since me and my team have now been working with your plugin for several months and it works wonders.

Up until now we had an Astar with a GridGraph and we painted Non Walkable zones with GraphUpdateScene.

We are seeing it would be easier for us to paint only the Walkable zone. For that to work, we would need the Grid Graph to set everything to Non Walkable as a default behaviour.

We’ve tried a workaround with a script that creates a GraphUpdateScene with the size of the GridGraph with:

  • Apply on Start: [ ]
  • Apply on Scan: [V]
  • Modify walkability: [V]
  • Walkability: [ ]

And the walkable ones to:

  • Apply on Start: [V]
  • Apply on Scan: [ ]
  • Modify walkability: [V]
  • Walkability: [V]

But this way we lose the “preview” of the walkable zone in editor.

It also means we have to manually set the zone every time and would mean to keep track of it in every scene, which is no good.

For now we were using the Free Version but I’ve seen that the pro feature LayeredGridGraphs may be able to help with this.

Thanks in advance.

Hi

I’m glad you like the package :slight_smile:

Do you need any height information?
If not then you can set Height Testing -> Mask to Nothing and enable the option “Unwalkable when no ground”.

If you are considering the pro version this is a case where reading walkability information from a texture could come in handy (pro version only). See http://arongranberg.com/astar/docs/class_pathfinding_1_1_grid_graph.php#ac855bb1ba0ecd663efca9bda41527a6c

I’m not sure how that would be of help.

Hello Aaron,

Thank you for your quick answer.

We need height information, so even with a workaround we tried today, the solution worked partially.

What we are considering is:

  • Creating a custom script which inherits from your GraphUpdateScene just to pick some points that define a Walkable region.

  • We’ll have a Game Object with various CustomScript and one GraphUpdateScene.

  • Then linking all of the polygons from the Walkable regions by its closest points and using the A* limits, we encapsulate the polygons to create a Non-Walkable region.

  • Using the new points, we edit the GraphUpdateScene with a Non-Walkable regions.

What do you think?

Thank you

Well, if you need height information then the raycasts are hitting some kind of ground, so you could simply set the grid graph -> Collision Testing -> mask to Everything. This will make it think the ground is an obstacle and will thus mark all nodes as unwalkable.