reckfellENGINE

ConvexPolygonShape2D

Filled convex geometry from an ordered contour or a point cloud.

On this page
class ConvexPolygonShape2DReckfellSharpInherits Shape2D

ConvexPolygonShape2D describes a filled convex polygon in local coordinates. A new resource has no vertices. For a collider, assign configured geometry to Shape on CollisionShape2D, which must be a direct child Entity of the required CollisionObject2D.

Choose the input method:

  • Points or SetPoints: prepared vertices in boundary order. The contour must be convex and free of self-intersections, with at least three noncollinear finite vertices. Do not pass arbitrarily shuffled points.
  • SetPointCloud: unordered points. Computes the outer convex hull; interior points and concavities are discarded. A hull therefore cannot accurately reproduce a silhouette with indentations.

SetPoints retains the supplied order. Physics winding is normalized on a copy, so Points readback can retain either winding. The current SetPointCloud result repeats the first vertex at the end: the checked square cloud produced Points.Length=5 despite having four unique corners. Do not infer unique-corner count from array length.

The C# getter returns a copy. To change one vertex, get Points, edit the array and assign it back. Editing the original array after SetPoints does not change the shape either. The setter emits Changed even for repeated data. GetRect() returns local bounds of all vertices, excluding the resource user’s transform.

Both overload families (array and ReadOnlySpan), copies, winding, hull generation, Changed and direct overlap with a circle inside a square were checked. Unlike a closed ConcavePolygonShape2D, convex geometry is filled. Body dynamics, performance and editor drawing were not tested.

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

Constructors1

ConvexPolygonShape2DConstructor
# ConvexPolygonShape2D
C#
public ConvexPolygonShape2D();

Creates a resource without vertices. Assign a valid convex contour before queries or collider use; the resource itself creates no physics body.

Properties1

PointsProperty
# Points
C#
public Vector2[] Points { get; set; }

Ordered local vertices of a convex contour. The setter copies data and emits Changed even on repetition; it does not compute a convex hull. The getter returns an independent array in stored order. Internal physics winding normalization does not reorder stored Points. Edit the copy and assign it back to update the shape.

Methods5

GetPointsVector2[]
# GetPoints
C#
public Vector2[] GetPoints();

Independent copy of stored local vertices. Editing the array does not update the resource; assign edited data through Points or SetPoints.

Returns Vector2[]

Independent copy of stored local vertices. Editing the array does not update the resource; assign edited data through Points or SetPoints.

SetPointCloud2 overloads
# SetPointCloud · 1/2
C#
public void SetPointCloud(Vector2[] pointCloud);

Computes the point cloud’s convex hull and passes it to SetPoints. Input order is irrelevant; interior points are discarded and concavities disappear. Supply finite points forming a nondegenerate polygon. The current result repeats its first vertex at the end; Points length is not the number of unique corners. Array and ReadOnlySpan overloads produce the same geometry; input is not retained as a shared mutable buffer.

Parameters
NameTypeDefault
pointCloudVector2[]—
pointCloud

Unordered finite points for an outer convex hull; the set must form a polygon of nonzero area. Interior points and concavities are not preserved.

# SetPointCloud · 2/2
C#
public void SetPointCloud(ReadOnlySpan<Vector2> pointCloud);

Computes the point cloud’s convex hull and passes it to SetPoints. Input order is irrelevant; interior points are discarded and concavities disappear. Supply finite points forming a nondegenerate polygon. The current result repeats its first vertex at the end; Points length is not the number of unique corners. Array and ReadOnlySpan overloads produce the same geometry; input is not retained as a shared mutable buffer.

Parameters
NameTypeDefault
pointCloudReadOnlySpan<Vector2>—
pointCloud

Unordered finite points for an outer convex hull; the set must form a polygon of nonzero area. Interior points and concavities are not preserved.

SetPoints2 overloads
# SetPoints · 1/2
C#
public void SetPoints(Vector2[] points);

Replaces vertices with a prepared convex contour in boundary order and emits Changed, including repeated data. Does not sort a point cloud or turn a concave contour convex. Supply at least three noncollinear finite vertices without self-intersections or zero-length edges. Data is copied; both winding directions support the same geometry. Use SetPointCloud for unordered points.

Parameters
NameTypeDefault
pointsVector2[]—
points

Prepared convex contour in boundary order: at least three noncollinear finite vertices, without self-intersections or zero-length edges. Not a point cloud.

# SetPoints · 2/2
C#
public void SetPoints(ReadOnlySpan<Vector2> points);

Replaces vertices with a prepared convex contour in boundary order and emits Changed, including repeated data. Does not sort a point cloud or turn a concave contour convex. Supply at least three noncollinear finite vertices without self-intersections or zero-length edges. Data is copied; both winding directions support the same geometry. Use SetPointCloud for unordered points.

Parameters
NameTypeDefault
pointsReadOnlySpan<Vector2>—
points

Prepared convex contour in boundary order: at least three noncollinear finite vertices, without self-intersections or zero-length edges. Not a point cloud.

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.