Topic was automatically imported from the old Question2Answer platform.
Asked By
DamonR
I have followed miziziziz’s YouTube video ( https://m.youtube.com/watch?v=A1xjUuRZmWQ ) and setup an astar grid map for an rts demo. But I have been unable to work out how to disable astar points within an area for when placing buildings. I have searched online, and have even looked at dynamic obstacle avoidance, but nothing I could find explains how to disable and re-enable astar points.
Hi, thanks for answering. I have managed to get the code to work using some spatial nodes placed roughly where the grid points will be, and using something like;
var point_to_disable = astar.get_closest_point(spatialVector3())
astar.set_point_disabled(point_to_disable, true)
After much trying, I still wasn’t able to get the grimap cell reference. Perhaps I have missed something, I haven’t worked much with gridmaps yet. How would you go about getting the gridmap index? I looked at how Miziziziz does it in his code, but am still at something of a loss.
As your answer helped me figure out how to disable them using spatials, I will mark it as answered.
Thanks.
D.
DamonR | 2020-07-20 17:15
this is the best way i think because you can convert between position and index with a function
gotm.io | gotm.io
and here is a working example where i disable a point when i close the door and it affects astar pathfinding (can only toggle door when standing beside it and click on it)