reckfellENGINE

PolygonPathFinder

A Reckfell C# SDK type.

On this page
class PolygonPathFinderReckfellSharpInherits Resource

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

Constructors1

PolygonPathFinderConstructor
# PolygonPathFinder
C#
public PolygonPathFinder();

Properties1

DataProperty
# Data
C#
public Reckfell.Collections.Dictionary Data { get; set; }

Methods9

FindPathVector2[]
# FindPath
C#
public Vector2[] FindPath(Vector2 from, Vector2 to);
Parameters
NameTypeDefault
fromVector2—
toVector2—
Returns Vector2[]
GetBoundsRect2
# GetBounds
C#
public Rect2 GetBounds();
Returns Rect2
GetClosestPointVector2
# GetClosestPoint
C#
public Vector2 GetClosestPoint(Vector2 point);
Parameters
NameTypeDefault
pointVector2—
Returns Vector2
GetIntersectionsVector2[]
# GetIntersections
C#
public Vector2[] GetIntersections(Vector2 from, Vector2 to);
Parameters
NameTypeDefault
fromVector2—
toVector2—
Returns Vector2[]
GetPointPenaltyfloat
# GetPointPenalty
C#
public float GetPointPenalty(int idx);
Parameters
NameTypeDefault
idxint—
Returns float
IsPointInsidebool
# IsPointInside
C#
public bool IsPointInside(Vector2 point);

Returns true if point falls inside the polygon area.

C#
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
Parameters
NameTypeDefault
pointVector2—
Returns bool
SetPointPenaltyvoid
# SetPointPenalty
C#
public void SetPointPenalty(int idx, float penalty);
Parameters
NameTypeDefault
idxint—
penaltyfloat—
Setup2 overloads
# Setup · 1/2
C#
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.

C#
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);
Parameters
NameTypeDefault
pointsVector2[]—
connectionsint[]—
# Setup · 2/2
C#
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.

C#
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);
Parameters
NameTypeDefault
pointsReadOnlySpan<Vector2>—
connectionsReadOnlySpan<int>—
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.