Topic was automatically imported from the old Question2Answer platform.
Asked By
Hasnep
I’m building a game with a regular square grid for A* pathfinding where the walls can be broken/placed like Minecraft. When a block is broken/placed, what should happen? Currently I delete/create the node (see image), but I was thinking, should I have a node for every square and create/destroy the appropriate edges connecting the nodes?
I originally asked this question on the Godot Matrix a while ago, and the solution I found was to use the is_point_disabled() and set_point_disabled() methods of the AStar or AStar2D classes instead of using remove_point like I was.
You can see the documentation for these functions here.
void set_point_disabled ( int id, bool disabled=true )
Disables or enables the specified point for pathfinding. Useful for making a temporary obstacle.