Godot Version
4.2.1
I’m trying to create an infinite map with the astar algorithm. When I move the camera, I redraw the grid lines in the visible area and in the same area I create a new AStarGrid2D in the corresponding coordinates.
The initial position is 0, 0, 1600, 900. So when you move the camera up, the dimensions for the grid and astara become 0, -16, 1600, 900. When the initial position of the AStarGrid2D is hidden outside the screen, it does not work correctly, for example this visible when moving by 0. -960.
In the project, the values of the AStarGrid2D region parameter are output to the console, as well as mouse clicks to check the operation of AStarGrid2D.
If you move the camera much higher, then when you click on the grid, the weight will be 0, and an error will appear in the debugger. That is, according to the correct AStarGrid2D ID, the point is not found. Moreover, if you return to the original visibility area and click on the same point, it will work correctly.
To check this, you can look at the minimal project
I don’t think I quite understand why this happens. Maybe there is an explanation for this?