reckfellENGINE

AStarGrid2D

Path search on a rectangular grid with obstacles, diagonal policies and cell weights.

On this page
class AStarGrid2DReckfellSharpInherits RefCounted

Workflow: set Region, CellSize, Offset and CellShape → call Update() → apply SetPointSolid/weights → query a path. A dirty rebuild resets obstacles and weights; a clean Update() changes nothing. Cells and connections are implicit, not Entities or a physics world.

IDs are in-Region Vector2I values with an exclusive end; GetPointPath returns Vector2 positions in your configured mapping. Default costs measure ID distances rather than scaled world positions. Match diagonal rules to obstacles and the heuristic to movement costs.

In 1.0.0, JumpingEnabled ignores weights and can return nonadjacent jump points. Use ordinary search for terrain-cost maps. Partial does not prove arrival: compare the last ID; a solid start yields no path. When changing geometry, rebuild first and then reapply cell overrides.

Dispose the owned instance. Small grids, negative origin, geometry, state reset, diagonals, jumping/weights and C# callbacks were tested in Windows headless. Large maps, concurrent search, arbitrary custom costs with jumping and physical clearance were not accepted.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

AStarGrid2DConstructor
# AStarGrid2D
C#
public AStarGrid2D();

Creates an empty grid. Set Region, CellSize/Offset/CellShape, call Update, then apply obstacles and weights. Adjacent-cell connections are implicit; no ConnectPoints call is needed. Dispose the owned RefCounted instance.

Properties9

CellShapeProperty
# CellShape
C#
public AStarGrid2D.CellShapeEnum CellShape { get; set; }

Selects Square, IsometricRight or IsometricDown for mapping IDs to positions. Changes require Update. Isometric mapping creates no collisions and does not change IDs or DiagonalMode adjacency. Max is an enum boundary, not a shape.

CellSizeProperty
# CellSize
C#
public Vector2 CellSize { get; set; }

Scale mapping IDs to Vector2 positions. For Square, position = Offset + Vector2(id) * CellSize; IDs are not relative to Region origin. Changes require Update, resetting cell overrides. Default costs use IDs, so this scale does not define world-unit route costs. Supply finite meaningful dimensions.

DefaultComputeHeuristicProperty
# DefaultComputeHeuristic
C#
public AStarGrid2D.Heuristic DefaultComputeHeuristic { get; set; }

Default transition-cost formula without a _ComputeCost override. Uses integer-ID differences: Euclidean=sqrt(dx²+dy²), Manhattan=dx+dy, Octile=max(dx,dy)+(sqrt(2)−1)*min(dx,dy), Chebyshev=max(dx,dy). Independent of CellSize/Offset. Ordinary search additionally applies destination weight. Changes require no Update.

DefaultEstimateHeuristicProperty
# DefaultEstimateHeuristic
C#
public AStarGrid2D.Heuristic DefaultEstimateHeuristic { get; set; }

Default remaining-cost estimate without an _EstimateCost override; not a charged transition. It must be admissible and consistent with movement and weights. Manhattan suits four-direction movement; do not automatically use it for cheaper diagonals. Weights <1/custom costs can require an override returning 0. Changes require no Update.

DiagonalModeProperty
# DiagonalMode
C#
public AStarGrid2D.DiagonalModeEnum DiagonalMode { get; set; }

Diagonal policy, changeable without Update: Always permits corner cutting even between two solid side cells; Never allows four directions; AtLeastOneWalkable requires one free side cell; OnlyIfNoObstacles requires both. The diagonal destination must always be free. This is a cell rule, not a character-radius test.

JumpingEnabledProperty
# JumpingEnabled
C#
public bool JumpingEnabled { get; set; }

Enables Jump Point Search without rebuilding. In 1.0.0 this branch ignores weight_scale, so expensive cells may no longer be avoided. Results can contain jump points without intermediate adjacent cells; consecutive array entries need not be adjacent. Use for suitable uniform-cost grids; no universal speedup is guaranteed.

OffsetProperty
# Offset
C#
public Vector2 Offset { get; set; }

Offset of returned Vector2 positions, not cell IDs or Region bounds. Changing it marks dirty. Update recalculates positions and resets solid/weights. An approximately equal value may not mark dirty.

RegionProperty
# Region
C#
public Rect2I Region { get; set; }

Integer cell-ID rectangle: inclusive start, exclusive end; the origin may be negative. Sizes must be ≥0. Changing it marks the grid dirty; call Update before cell/path access. Rebuilding resets solid and weight_scale, so apply them after Update.

SizeProperty · Deprecated
# Size
C#
public Vector2I Size { get; set; }

Obsolete C# property for Region size without controlling its origin; use Region. Not the pixel size of a cell. Writing a changed size requires Update and loses cell overrides on rebuild.

Methods37

Clearvoid
# Clear
C#
public void Clear();

Clears points and empties Region; does not restore all settings to defaults. Offset, CellSize and search policies remain. For a new map, assign a new nonempty Region, call Update and reapply obstacles/weights. Not a command to clear obstacles alone.

FillSolidRegionvoid
# FillSolidRegion
C#
public void FillSolidRegion(Rect2I region, bool solid = true);

On an initialized grid, sets solid over the supplied rectangle intersected with Region, excluding its end. Cells outside the intersection remain unchanged. No Update required; a later dirty rebuild resets values. An empty intersection changes nothing.

Parameters
NameTypeDefault
regionRect2I—
solidbooltrue
region

ID rectangle with nonnegative dimensions; fill/query operations use its intersection with Region.

solid

true blocks, false unblocks; true by default.

FillWeightScaleRegionvoid
# FillWeightScaleRegion
C#
public void FillWeightScaleRegion(Rect2I region, float weightScale);

Assigns one finite weight ≥0 throughout the rectangle intersected with Region; does not mark dirty. Replaces rather than adds to old weights. Jumping ignores weights, and a dirty Update resets them to 1.

Parameters
NameTypeDefault
regionRect2I—
weightScalefloat—
region

ID rectangle with nonnegative dimensions; fill/query operations use its intersection with Region.

weightScale

Finite entry multiplier ≥0; ignored with JumpingEnabled.

GetCellShapeAStarGrid2D.CellShapeEnum
# GetCellShape
C#
public AStarGrid2D.CellShapeEnum GetCellShape();

Reads current CellShape; rebuilds nothing. Selects Square, IsometricRight or IsometricDown for mapping IDs to positions. Changes require Update. Isometric mapping creates no collisions and does not change IDs or DiagonalMode adjacency. Max is an enum boundary, not a shape.

Returns AStarGrid2D.CellShapeEnum

Current CellShape value; see the description for units and constraints.

GetCellSizeVector2
# GetCellSize
C#
public Vector2 GetCellSize();

Reads current CellSize; rebuilds nothing. Scale mapping IDs to Vector2 positions. For Square, position = Offset + Vector2(id) * CellSize; IDs are not relative to Region origin. Changes require Update, resetting cell overrides. Default costs use IDs, so this scale does not define world-unit route costs. Supply finite meaningful dimensions.

Returns Vector2

Current CellSize value; see the description for units and constraints.

GetDefaultComputeHeuristicAStarGrid2D.Heuristic
# GetDefaultComputeHeuristic
C#
public AStarGrid2D.Heuristic GetDefaultComputeHeuristic();

Reads current DefaultComputeHeuristic; rebuilds nothing. Default transition-cost formula without a _ComputeCost override. Uses integer-ID differences: Euclidean=sqrt(dx²+dy²), Manhattan=dx+dy, Octile=max(dx,dy)+(sqrt(2)−1)*min(dx,dy), Chebyshev=max(dx,dy). Independent of CellSize/Offset. Ordinary search additionally applies destination weight. Changes require no Update.

Returns AStarGrid2D.Heuristic

Current DefaultComputeHeuristic value; see the description for units and constraints.

GetDefaultEstimateHeuristicAStarGrid2D.Heuristic
# GetDefaultEstimateHeuristic
C#
public AStarGrid2D.Heuristic GetDefaultEstimateHeuristic();

Reads current DefaultEstimateHeuristic; rebuilds nothing. Default remaining-cost estimate without an _EstimateCost override; not a charged transition. It must be admissible and consistent with movement and weights. Manhattan suits four-direction movement; do not automatically use it for cheaper diagonals. Weights <1/custom costs can require an override returning 0. Changes require no Update.

Returns AStarGrid2D.Heuristic

Current DefaultEstimateHeuristic value; see the description for units and constraints.

GetDiagonalModeAStarGrid2D.DiagonalModeEnum
# GetDiagonalMode
C#
public AStarGrid2D.DiagonalModeEnum GetDiagonalMode();

Reads current DiagonalMode; rebuilds nothing. Diagonal policy, changeable without Update: Always permits corner cutting even between two solid side cells; Never allows four directions; AtLeastOneWalkable requires one free side cell; OnlyIfNoObstacles requires both. The diagonal destination must always be free. This is a cell rule, not a character-radius test.

Returns AStarGrid2D.DiagonalModeEnum

Current DiagonalMode value; see the description for units and constraints.

GetIdPath2 overloads
# GetIdPath · 1/2
C#
public Reckfell.Collections.Array<Vector2I> GetIdPath(Vector2I fromId, Vector2I toId);

Returns cell IDs from start to end, including endpoints. Requires a clean grid and both IDs within Region, even for partial queries. A solid start yields empty; a walkable fromId==toId yields one ID. An unreachable/solid goal yields empty with partial=false; true can end at a reached candidate. Check the last ID before declaring arrival. Jumping can omit intermediate cells. Do not run concurrent searches/mutations on one instance.

Parameters
NameTypeDefault
fromIdVector2I—
toIdVector2I—
fromId

In-Region path/transition start ID; search requires a walkable start.

toId

In-Region goal/destination ID; partial does not permit an out-of-Region goal.

Returns Reckfell.Collections.Array<Vector2I>

New typed Array<Vector2I>; empty without a result, and partial can miss the goal. This type has no Dispose method.

# GetIdPath · 2/2
C#
public Reckfell.Collections.Array<Vector2I> GetIdPath(Vector2I fromId, Vector2I toId, bool allowPartialPath = false);

Returns cell IDs from start to end, including endpoints. Requires a clean grid and both IDs within Region, even for partial queries. A solid start yields empty; a walkable fromId==toId yields one ID. An unreachable/solid goal yields empty with partial=false; true can end at a reached candidate. Check the last ID before declaring arrival. Jumping can omit intermediate cells. Do not run concurrent searches/mutations on one instance.

Parameters
NameTypeDefault
fromIdVector2I—
toIdVector2I—
allowPartialPathboolfalse
fromId

In-Region path/transition start ID; search requires a walkable start.

toId

In-Region goal/destination ID; partial does not permit an out-of-Region goal.

allowPartialPath

true permits ending at a reached candidate, but permits neither a solid start nor out-of-Region endpoints.

Returns Reckfell.Collections.Array<Vector2I>

New typed Array<Vector2I>; empty without a result, and partial can miss the goal. This type has no Dispose method.

GetOffsetVector2
# GetOffset
C#
public Vector2 GetOffset();

Reads current Offset; rebuilds nothing. Offset of returned Vector2 positions, not cell IDs or Region bounds. Changing it marks dirty. Update recalculates positions and resets solid/weights. An approximately equal value may not mark dirty.

Returns Vector2

Current Offset value; see the description for units and constraints.

GetPointDataInRegionReckfell.Collections.Array<Reckfell.Collections.Dictionary>
# GetPointDataInRegion
C#
public Reckfell.Collections.Array<Reckfell.Collections.Dictionary> GetPointDataInRegion(Rect2I region);

Returns new Dictionary snapshots for the rectangle intersected with Region: id:Vector2I, position:Vector2, solid:bool, weight_scale:float. Requires an initialized grid. Editing a Dictionary does not edit the grid. Dispose owned Dictionary wrappers after use; the typed Array has no Dispose method.

Parameters
NameTypeDefault
regionRect2I—
region

ID rectangle with nonnegative dimensions; fill/query operations use its intersection with Region.

Returns Reckfell.Collections.Array<Reckfell.Collections.Dictionary>

Typed Array<Dictionary> of intersected-cell snapshots; may be empty.

GetPointPath2 overloads
# GetPointPath · 1/2
C#
public Vector2[] GetPointPath(Vector2I fromId, Vector2I toId);

Returns route Vector2 positions under the same validity/partial rules as GetIdPath. Geometry comes from CellSize/Offset/CellShape rather than Entity transforms. Not smoothing, physical clearance or character control. Jumping can omit intermediate cells; the array is an independent snapshot.

Parameters
NameTypeDefault
fromIdVector2I—
toIdVector2I—
fromId

In-Region path/transition start ID; search requires a walkable start.

toId

In-Region goal/destination ID; partial does not permit an out-of-Region goal.

Returns Vector2[]

New independent Vector2[] route positions; may be empty or partial.

# GetPointPath · 2/2
C#
public Vector2[] GetPointPath(Vector2I fromId, Vector2I toId, bool allowPartialPath = false);

Returns route Vector2 positions under the same validity/partial rules as GetIdPath. Geometry comes from CellSize/Offset/CellShape rather than Entity transforms. Not smoothing, physical clearance or character control. Jumping can omit intermediate cells; the array is an independent snapshot.

Parameters
NameTypeDefault
fromIdVector2I—
toIdVector2I—
allowPartialPathboolfalse
fromId

In-Region path/transition start ID; search requires a walkable start.

toId

In-Region goal/destination ID; partial does not permit an out-of-Region goal.

allowPartialPath

true permits ending at a reached candidate, but permits neither a solid start nor out-of-Region endpoints.

Returns Vector2[]

New independent Vector2[] route positions; may be empty or partial.

GetPointPositionVector2
# GetPointPosition
C#
public Vector2 GetPointPosition(Vector2I id);

Returns an initialized cell calculated Vector2 position. For Square this is Offset + Vector2(id) * CellSize without subtracting Region.Position; isometric shapes use half-size and transformed axes. Not an automatic Entity world position.

Parameters
NameTypeDefault
idVector2I—
id

In-Region cell ID; cell access/mutation requires dirty=false.

Returns Vector2

Calculated Vector2; dirty/invalid IDs yield diagnostics and a zero fallback.

GetPointWeightScalefloat
# GetPointWeightScale
C#
public float GetPointWeightScale(Vector2I id);

Reads an initialized cell stored weight. The value does not prove jumping search uses it. Dirty/invalid IDs produce diagnostics and a zero fallback.

Parameters
NameTypeDefault
idVector2I—
id

In-Region cell ID; cell access/mutation requires dirty=false.

Returns float

Stored weight; a diagnosed zero fallback is not a successful read.

GetRegionRect2I
# GetRegion
C#
public Rect2I GetRegion();

Reads current Region; rebuilds nothing. Integer cell-ID rectangle: inclusive start, exclusive end; the origin may be negative. Sizes must be ≥0. Changing it marks the grid dirty; call Update before cell/path access. Rebuilding resets solid and weight_scale, so apply them after Update.

Returns Rect2I

Current Region value; see the description for units and constraints.

GetSizeVector2I
# GetSize
C#
public Vector2I GetSize();

Reads Region.Size only. The SDK method is not marked Obsolete although the Size property is; use Region.Size in new code. Returns neither CellSize nor a rebuilt grid.

Returns Vector2I

Current Size value; see the description for units and constraints.

IsDirtybool
# IsDirty
C#
public bool IsDirty();

Reports geometry changes requiring Update. false does not imply a nonempty or traversable grid: a new instance has an empty Region and dirty=false. IsInBounds tests Region rather than cell-data readiness.

Returns bool

true for pending rebuild; false does not prove a nonempty map.

IsInBoundsbool
# IsInBounds
C#
public bool IsInBounds(int x, int y);

Tests x/y against current Region with an exclusive end boundary. Does not check solid state, reachability, dirty state or rebuilt data availability.

Parameters
NameTypeDefault
xint—
yint—
x

Integer ID X coordinate, not a world position.

y

Integer ID Y coordinate, not a world position.

Returns bool

Whether the ID is in Region, independently of dirty/solid.

IsInBoundsvbool
# IsInBoundsv
C#
public bool IsInBoundsv(Vector2I id);

Same Region test as IsInBounds, taking a Vector2I ID. Being in bounds does not permit dirty-grid access before Update.

Parameters
NameTypeDefault
idVector2I—
id

In-Region cell ID; cell access/mutation requires dirty=false.

Returns bool

Whether the ID is in Region, independently of dirty/solid.

IsJumpingEnabledbool
# IsJumpingEnabled
C#
public bool IsJumpingEnabled();

Reads current JumpingEnabled; rebuilds nothing. Enables Jump Point Search without rebuilding. In 1.0.0 this branch ignores weight_scale, so expensive cells may no longer be avoided. Results can contain jump points without intermediate adjacent cells; consecutive array entries need not be adjacent. Use for suitable uniform-cost grids; no universal speedup is guaranteed.

Returns bool

Current JumpingEnabled value; see the description for units and constraints.

IsPointSolidbool
# IsPointSolid
C#
public bool IsPointSolid(Vector2I id);

Reads an initialized in-Region cell obstacle flag. Dirty/invalid IDs produce a diagnosed false fallback, not proof of walkability. Check IsDirty and IsInBoundsv first.

Parameters
NameTypeDefault
idVector2I—
id

In-Region cell ID; cell access/mutation requires dirty=false.

Returns bool

Solid flag; a diagnosed false on error does not mean a free cell.

SetCellShapevoid
# SetCellShape
C#
public void SetCellShape(AStarGrid2D.CellShapeEnum cellShape);

Sets CellShape. Selects Square, IsometricRight or IsometricDown for mapping IDs to positions. Changes require Update. Isometric mapping creates no collisions and does not change IDs or DiagonalMode adjacency. Max is an enum boundary, not a shape.

Parameters
NameTypeDefault
cellShapeAStarGrid2D.CellShapeEnum—
cellShape

Square, IsometricRight or IsometricDown; not Max.

SetCellSizevoid
# SetCellSize
C#
public void SetCellSize(Vector2 cellSize);

Sets CellSize. Scale mapping IDs to Vector2 positions. For Square, position = Offset + Vector2(id) * CellSize; IDs are not relative to Region origin. Changes require Update, resetting cell overrides. Default costs use IDs, so this scale does not define world-unit route costs. Supply finite meaningful dimensions.

Parameters
NameTypeDefault
cellSizeVector2—
cellSize

Finite cell-geometry scale; default costs operate on IDs.

SetDefaultComputeHeuristicvoid
# SetDefaultComputeHeuristic
C#
public void SetDefaultComputeHeuristic(AStarGrid2D.Heuristic heuristic);

Sets DefaultComputeHeuristic. Default transition-cost formula without a _ComputeCost override. Uses integer-ID differences: Euclidean=sqrt(dx²+dy²), Manhattan=dx+dy, Octile=max(dx,dy)+(sqrt(2)−1)*min(dx,dy), Chebyshev=max(dx,dy). Independent of CellSize/Offset. Ordinary search additionally applies destination weight. Changes require no Update.

Parameters
NameTypeDefault
heuristicAStarGrid2D.Heuristic—
heuristic

Euclidean, Manhattan, Octile or Chebyshev; match movement and weights.

SetDefaultEstimateHeuristicvoid
# SetDefaultEstimateHeuristic
C#
public void SetDefaultEstimateHeuristic(AStarGrid2D.Heuristic heuristic);

Sets DefaultEstimateHeuristic. Default remaining-cost estimate without an _EstimateCost override; not a charged transition. It must be admissible and consistent with movement and weights. Manhattan suits four-direction movement; do not automatically use it for cheaper diagonals. Weights <1/custom costs can require an override returning 0. Changes require no Update.

Parameters
NameTypeDefault
heuristicAStarGrid2D.Heuristic—
heuristic

Euclidean, Manhattan, Octile or Chebyshev; match movement and weights.

SetDiagonalModevoid
# SetDiagonalMode
C#
public void SetDiagonalMode(AStarGrid2D.DiagonalModeEnum mode);

Sets DiagonalMode. Diagonal policy, changeable without Update: Always permits corner cutting even between two solid side cells; Never allows four directions; AtLeastOneWalkable requires one free side cell; OnlyIfNoObstacles requires both. The diagonal destination must always be free. This is a cell rule, not a character-radius test.

Parameters
NameTypeDefault
modeAStarGrid2D.DiagonalModeEnum—
mode

One of four diagonal policies; Max is not a mode.

SetJumpingEnabledvoid
# SetJumpingEnabled
C#
public void SetJumpingEnabled(bool enabled);

Sets JumpingEnabled. Enables Jump Point Search without rebuilding. In 1.0.0 this branch ignores weight_scale, so expensive cells may no longer be avoided. Results can contain jump points without intermediate adjacent cells; consecutive array entries need not be adjacent. Use for suitable uniform-cost grids; no universal speedup is guaranteed.

Parameters
NameTypeDefault
enabledbool—
enabled

Enables the jumping branch, not obstacles or rebuilding.

SetOffsetvoid
# SetOffset
C#
public void SetOffset(Vector2 offset);

Sets Offset. Offset of returned Vector2 positions, not cell IDs or Region bounds. Changing it marks dirty. Update recalculates positions and resets solid/weights. An approximately equal value may not mark dirty.

Parameters
NameTypeDefault
offsetVector2—
offset

Finite calculated-position offset rather than cell IDs.

SetPointSolidvoid
# SetPointSolid
C#
public void SetPointSolid(Vector2I id, bool solid = true);

On an initialized grid, marks an existing cell solid=true by default; false opens it. ID must be in Region. Does not mark dirty or require Update. A solid start yields no path; a solid goal permits partial only. A later dirty rebuild erases the flag.

Parameters
NameTypeDefault
idVector2I—
solidbooltrue
id

In-Region cell ID; cell access/mutation requires dirty=false.

solid

true blocks, false unblocks; true by default.

SetPointWeightScalevoid
# SetPointWeightScale
C#
public void SetPointWeightScale(Vector2I id, float weightScale);

Sets a finite nonnegative entry-cost multiplier on an initialized cell; no Update needed. The start cell has no entry charge. Does not block a cell; use solid to forbid it. JumpingEnabled retains the weight but search ignores it. Validate NaN/Infinity yourself.

Parameters
NameTypeDefault
idVector2I—
weightScalefloat—
id

In-Region cell ID; cell access/mutation requires dirty=false.

weightScale

Finite entry multiplier ≥0; ignored with JumpingEnabled.

SetRegionvoid
# SetRegion
C#
public void SetRegion(Rect2I region);

Sets Region. Integer cell-ID rectangle: inclusive start, exclusive end; the origin may be negative. Sizes must be ≥0. Changing it marks the grid dirty; call Update before cell/path access. Rebuilding resets solid and weight_scale, so apply them after Update.

Parameters
NameTypeDefault
regionRect2I—
region

ID rectangle with nonnegative dimensions; fill/query operations use its intersection with Region.

SetSizevoid
# SetSize
C#
public void SetSize(Vector2I size);

Legacy Region-size setter: native setter emits a warning. Unlike the Size property, this C# method is not marked Obsolete in the SDK. Use Region; Region origin remains, and changed size requires Update.

Parameters
NameTypeDefault
sizeVector2I—
size

New nonnegative Region size; prefer setting the entire Region.

Updatevoid
# Update
C#
public void Update();

Does nothing when dirty=false. Otherwise recreates Region cells, positions and boundaries and marks clean; ALL solid flags reset to false and weights to 1. Use geometry → Update → obstacles/weights → path. SetPointSolid/SetPointWeightScale do not require Update.

_ComputeCostfloat
# _ComputeCost
C#
public virtual float _ComputeCost(Vector2I fromId, Vector2I toId);

Overrides base transition cost between IDs. Ordinary search additionally multiplies by destination weight; jumping ignores weights and can pass nonadjacent jump points. Without an override, DefaultComputeHeuristic uses IDs. C# base._ComputeCost returns default(float), not the native formula. Return a finite nonnegative cost.

Parameters
NameTypeDefault
fromIdVector2I—
toIdVector2I—
fromId

In-Region path/transition start ID; search requires a walkable start.

toId

In-Region goal/destination ID; partial does not permit an out-of-Region goal.

Returns float

Finite nonnegative base transition cost.

_EstimateCostfloat
# _EstimateCost
C#
public virtual float _EstimateCost(Vector2I fromId, Vector2I endId);

Overrides estimated remaining cost. Optimality requires an admissible consistent heuristic; closed cells are not reopened. For arbitrary nonnegative costs, return 0 is a safe starting estimate for ordinary search. Without an override, DefaultEstimateHeuristic applies; a C# base call returns default(float). Arbitrary custom costs with Jumping require separate validation.

Parameters
NameTypeDefault
fromIdVector2I—
endIdVector2I—
fromId

In-Region path/transition start ID; search requires a walkable start.

endId

Goal ID used to estimate remaining cost.

Returns float

Finite consistent lower-bound estimate of remaining cost.

AStarGrid2D.CellShapeEnum

ValueDescription
IsometricDown = 2

Diamond cell shape (for isometric look). Cell coordinates layout where the horizontal axis goes down-right, and the vertical one goes down-left.

IsometricRight = 1

Diamond cell shape (for isometric look). Cell coordinates layout where the horizontal axis goes up-right, and the vertical one goes down-right.

Max = 3

Represents the size of the AStarGrid2D.CellShapeEnum enum.

Square = 0

Rectangular cell shape.

AStarGrid2D.DiagonalModeEnum

ValueDescription
Always = 0

The pathfinding algorithm will ignore solid neighbors around the target cell and allow passing using diagonals.

AtLeastOneWalkable = 2

The pathfinding algorithm will avoid using diagonals if at least two obstacles have been placed around the neighboring cells of the specific path segment.

Max = 4

Represents the size of the AStarGrid2D.DiagonalModeEnum enum.

Never = 1

The pathfinding algorithm will ignore all diagonals and the way will be always orthogonal.

OnlyIfNoObstacles = 3

The pathfinding algorithm will avoid using diagonals if any obstacle has been placed around the neighboring cells of the specific path segment.

AStarGrid2D.Heuristic

ValueDescription
Chebyshev = 3

The Chebyshev heuristic to be used for the pathfinding using the following formula:

Text
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:

Text
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:

Text
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 AStarGrid2D.DiagonalMode to AStarGrid2D.DiagonalModeEnum.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:

Text
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;
Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.