Home › Forums › A* Pathfinding Project › Support › Example of how to filter walkability of nodes in GridGraph?
Tagged: tigmed madame
This topic has 2 voices, contains 4 replies, and was last updated by DeathByHugs 87 days ago.
| Author | Posts |
|---|---|
| Author | Posts |
| December 23, 2011 at 22:16 #1131 | |
|
Learner |
Could we get an example of how to filter nodes on GridGraph for things like walkability during the graph generation? For some of the issues I’ve been fighting, this would be useful. Maybe something like removing all nodes that can’t be reach from a certain point (to make rooftop & tree tops unwalkable, instead of walkable at a different height). One issue I’m fighting is I don’t have direct control of my map and there are overhanging trees, lights, balconies, flat rooms narrow dividing walls (some only shoulder high) etc all built into the ground layer (not separate objects). So tuning the parameters for GridGraph is tricky and I don’t want to have to go around and flag all those areas manually as unwalkable.. |
| December 25, 2011 at 00:20 #1139 | |
|
Aron Granberg |
Hm… something like this maybe:
GridGraph graph = AstarPath.active.astarData.gridGraph; //Shortcut to the first grid graph Note: code written directly on page, not checked, but I think it should work I hope it works for you! |
| January 4, 2012 at 00:03 #1230 | |
|
Learner |
Thanks, that was a big help once I corrected the for loop errors cause by the forums mangling. |
| February 21, 2012 at 19:55 #1544 | |
|
DeathByHugs |
Well with what i am working on the grid objects can be edited so when i am finished moving everything around i use this code to set the walkability. It work about 50% of the time depending on how i block off the path. I can move a block one unit to the side and then it will say that all the open node without objects on them can be reached even tho they are still blocked. I need it to work 100% of the time editing the objects in the area is a big part of the game and i need the AI to keep up with it. |
| February 21, 2012 at 20:57 #1545 | |
|
DeathByHugs |
Well I guess i posted this a little to early i fixed it by setting the Min area size to 1. Hopefully this helps someone else. |