AStar solid but in solution still?

Godot Version

4.X

Question

I set (0, 1) to solid, but it’s still in the solution:

	var astar_grid = AStarGrid2D.new()
	astar_grid.region = Rect2i(0, 0, 4, 4)
	astar_grid.set_point_solid(Vector2i(0, 1), true)
	astar_grid.diagonal_mode = AStarGrid2D.DIAGONAL_MODE_NEVER
	astar_grid.update()
	print(astar_grid.get_id_path(Vector2i(0, 0), Vector2i(1,2)))

OUTPUT:

[(0, 0), (0, 1), (1, 1), (1, 2)]

Have I discovered a bug in Godot?

The function update() has this note:

Note: All point data (solidity and weight scale) will be cleared.

So calling update() resets the points that were previously set to solid, if I understand correctly.
Try calling update() first then set a point to solid to test it.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.