Enum AStarGrid2D.Heuristic
- Namespace
- Godot
- Assembly
- GodotSharp.dll
public enum AStarGrid2D.Heuristic : long
Fields
Chebyshev = 3
The Chebyshev heuristic to be used for the pathfinding using the following formula:
dx = abs(to_id.x - from_id.x) dy = abs(to_id.y - from_id.y) result = max(dx, dy)
Euclidean = 0
The Euclidean heuristic to be used for the pathfinding using the following formula:
dx = abs(to_id.x - from_id.x) dy = abs(to_id.y - from_id.y) result = sqrt(dx * dx + dy * dy)
Note: This is also the internal heuristic used in AStar3D and AStar2D by default (with the inclusion of possible z-axis coordinate).
Manhattan = 1
The Manhattan heuristic to be used for the pathfinding using the following formula:
dx = abs(to_id.x - from_id.x) dy = abs(to_id.y - from_id.y) result = dx + dy
Note: This heuristic is intended to be used with 4-side orthogonal movements, provided by setting the DiagonalMode to Never.
Max = 4
Represents the size of the AStarGrid2D.Heuristic enum.
Octile = 2
The Octile heuristic to be used for the pathfinding using the following formula:
dx = abs(to_id.x - from_id.x) dy = abs(to_id.y - from_id.y) f = sqrt(2) - 1 result = (dx < dy) ? f * dx + dy : f * dy + dx;