Called when computing the cost between two connected points.
Called when estimating the cost between a point and the path's ending point.
Adds a new point at the given position with the given identifier. The algorithm prefers points with lower weight_scale to form a path. The id must be 0 or larger, and the weight_scale must be 1 or larger.
Returns whether there is a connection/segment between the given points.
Clears all the points and segments.
Creates a segment between the given points.
Deletes the segment between the given points.
Returns the next available point id with no point associated to it.
Returns the id of the closest point to to_position. Returns -1 if there are no points in the points pool.
Returns the closest position to to_position that resides inside a segment between two connected points.
Returns an array with the ids of the points that form the path found by AStar between the given points. The array is ordered from the starting point to the ending point of the path.
Returns an array with the ids of the points that form the connect with the given point.
Returns an array with the points that are in the path found by AStar between the given points. The array is ordered from the starting point to the ending point of the path.
Returns the position of the point associated with the given id.
Returns the weight scale of the point associated with the given id.
Returns an array of all points.
Returns whether a point associated with the given id exists.
Removes the point associated with the given id from the points pool.
Sets the position for the point with the given id.
Sets the weight_scale for the point with the given id.
AStar class representation that uses vectors as edges.
A* (A star) is a computer algorithm that is widely used in pathfinding and graph traversal, the process of plotting an efficiently directed path between multiple points. It enjoys widespread use due to its performance and accuracy. Godot's A* implementation make use of vectors as points. You must add points manually with AStar.addPoint and create segments manually with AStar.connectPoints. So you can test if there is a path between two points with the AStar.arePointsConnected function, get the list of existing ids in the found path with AStar.getIdPath, or the points list with AStar.getPointPath.