Godot Version
4.3
Question
Calling update() on an AStarGrid2D seems to no longer clear solidity/weight of cells, despite the documentation stating “all point data (solidity and weight scale) will be cleared.” This worked in v4.2.2, but no longer works in 4.3. Is this intended? I couldn’t find any release notes stating that this has been changed.
Am I missing something or should I report a bug? Reproduction method below.
- Create new project with a new scene
- Add the script below to the scene’s root Node
- Run the scene and note the results of the prints
extends Node
func _ready():
print("HELLO")
# Create the AStarGrid2D
var astar = AStarGrid2D.new()
astar.region = Rect2i(0,0,3,3)
astar.update()
# Set one of the grid's cells as solid and change its weight
astar.set_point_solid(Vector2i(1,1), true)
astar.set_point_weight_scale(Vector2i(1,1), 10.0)
# Update the AStarGrid2D: according to the docs, "all point data (solidity and weight scale) will be cleared", resetting the cell we changed... right?
astar.update()
for n in astar.region.size.x:
for m in astar.region.size.y:
# For each cell; print whether it's solid or not. All cells SHOULD be non-solid because of the update()
print(str(Vector2i(n,m)) +": " +str(astar.is_point_solid(Vector2i(n,m))) + " | " + str(astar.get_point_weight_scale(Vector2i(n,m))))
# Godot 4.2.2: Prints everything as 'false' as with a weight of "1"
# Godot 4.3: The cell we changed earlier is still printed as solid being 'true', with a weight of "10", despite having called update()