0 votes

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?

Astar pathfinding grid

in Engine by (53 points)

1 Answer

+1 vote
Best answer

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.

by (53 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.