PolygonPathFinder
A Reckfell C# SDK type.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
PolygonPathFinderConstructor
public PolygonPathFinder();Properties1
DataProperty
public Reckfell.Collections.Dictionary Data { get; set; }Methods9
FindPathVector2[]
public Vector2[] FindPath(Vector2 from, Vector2 to);| Name | Type | Default |
|---|---|---|
from | Vector2 | — |
to | Vector2 | — |
Returns
Vector2[]GetBoundsRect2
public Rect2 GetBounds();Returns
Rect2GetClosestPointVector2
public Vector2 GetClosestPoint(Vector2 point);| Name | Type | Default |
|---|---|---|
point | Vector2 | — |
Returns
Vector2GetIntersectionsVector2[]
public Vector2[] GetIntersections(Vector2 from, Vector2 to);| Name | Type | Default |
|---|---|---|
from | Vector2 | — |
to | Vector2 | — |
Returns
Vector2[]GetPointPenaltyfloat
public float GetPointPenalty(int idx);| Name | Type | Default |
|---|---|---|
idx | int | — |
Returns
floatIsPointInsidebool
public bool IsPointInside(Vector2 point);Returns true if point falls inside the polygon area.
var polygonPathFinder = new PolygonPathFinder();
Vector2[] points =
[
new Vector2(0.0f, 0.0f),
new Vector2(1.0f, 0.0f),
new Vector2(0.0f, 1.0f)
];
int[] connections = [0, 1, 1, 2, 2, 0];
polygonPathFinder.Setup(points, connections);
ReckfellApi.Print(polygonPathFinder.IsPointInside(new Vector2(0.2f, 0.2f))); // Prints True
ReckfellApi.Print(polygonPathFinder.IsPointInside(new Vector2(1.0f, 1.0f))); // Prints False| Name | Type | Default |
|---|---|---|
point | Vector2 | — |
Returns
boolSetPointPenaltyvoid
public void SetPointPenalty(int idx, float penalty);| Name | Type | Default |
|---|---|---|
idx | int | — |
penalty | float | — |
Setup2 overloads
public void Setup(Vector2[] points, int[] connections);Sets up PolygonPathFinder with an array of points that define the vertices of the polygon, and an array of indices that determine the edges of the polygon.
The length of connections must be even, returns an error if odd.
var polygonPathFinder = new PolygonPathFinder();
Vector2[] points =
[
new Vector2(0.0f, 0.0f),
new Vector2(1.0f, 0.0f),
new Vector2(0.0f, 1.0f)
];
int[] connections = [0, 1, 1, 2, 2, 0];
polygonPathFinder.Setup(points, connections);| Name | Type | Default |
|---|---|---|
points | Vector2[] | — |
connections | int[] | — |
public void Setup(ReadOnlySpan<Vector2> points, ReadOnlySpan<int> connections);Sets up PolygonPathFinder with an array of points that define the vertices of the polygon, and an array of indices that determine the edges of the polygon.
The length of connections must be even, returns an error if odd.
var polygonPathFinder = new PolygonPathFinder();
Vector2[] points =
[
new Vector2(0.0f, 0.0f),
new Vector2(1.0f, 0.0f),
new Vector2(0.0f, 1.0f)
];
int[] connections = [0, 1, 1, 2, 2, 0];
polygonPathFinder.Setup(points, connections);| Name | Type | Default |
|---|---|---|
points | ReadOnlySpan<Vector2> | — |
connections | ReadOnlySpan<int> | — |
Reckfell Engine documentationBack to top ↑