Skip to content

Iterating with AStar's get_available_point_id method #38263

Closed
@almighty-atlas

Description

Godot version:
3.2

OS/device including version:
Windows 10 Pro 1909

Issue description:
When you try to iterate with the get_available_point_id method of the AStar class you get an index order of [1, 0, 2, 3, 4 ...] since the method returns 1 if empty.

Steps to reproduce:

  1. Make a Project with a Scene with a TileMap and create an 8x8 grid for example.
  2. Attach following script to it:
func _ready() -> void:
    var astar = AStar2D.new()
    var cells = get_used_cells()
    for cell in cells:
        astar.add_point(astar.get_available_point_id(), cell)
    print(astar.get_points())
  1. Output:
    [1, 0, 2, 3, 4, 5, ...]

Minimal reproduction project:
See 2.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions