reckfellENGINE

SegmentShape2D

A zero-thickness segment between two local points.

On this page
class SegmentShape2DReckfellSharpInherits Shape2D

SegmentShape2D defines one segment with endpoints A and B. Defaults are A=(0,0), B=(0,10). B is the second endpoint coordinate, not an offset from A. For example, A=(-10,0), B=(10,0) defines a horizontal segment of length 20. Use finite distinct endpoints.

The physics shape has no thickness. A thick diagnostic stroke does not turn it into a rectangle: in the check, a radius-1 circle overlapped the line at center (0,0.5), but not at (0,2). For a wall with thickness, use RectangleShape2D or a convex polygon.

GetRect() encloses local A and B. A horizontal segment has zero bounds height; a vertical segment has zero width. These are valid results, not loading errors. Use a shape query for collision rather than testing whether the rectangle has area. A/B and SetA/SetB update the same geometry; Changed is emitted only for a new value.

For a collider, assign the resource to Shape on CollisionShape2D, which must be a direct child Entity of CollisionObject2D. Creating a resource alone adds no body to the world. Editing a shared resource affects every user.

Defaults, both setters/getters, notifications, local bounds and direct circle overlaps were checked. Body response, fast movement, image quality and other backends were not tested.

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

Constructors1

SegmentShape2DConstructor
# SegmentShape2D
C#
public SegmentShape2D();

Creates a zero-thickness segment from A=(0,0) to B=(0,10). Creates neither a body nor an automatically visible line.

Properties2

AProperty
# A
C#
public Vector2 A { get; set; }

First endpoint in local coordinates, initially (0,0). B holds the second endpoint; this is not the Entity’s world position. Use finite distinct endpoints. A change updates the physics shape and emits Changed; repeating a value does not.

BProperty
# B
C#
public Vector2 B { get; set; }

Second endpoint in local coordinates, initially (0,10). A point, not a rectangle size or an offset from A. Use a finite value distinct from A. A change emits Changed; repeating a value does not.

Methods4

GetAVector2
# GetA
C#
public Vector2 GetA();

Stored local coordinate of the first endpoint.

Returns Vector2

Stored local coordinate of the first endpoint.

GetBVector2
# GetB
C#
public Vector2 GetB();

Stored local coordinate of the second endpoint, not an offset from A.

Returns Vector2

Stored local coordinate of the second endpoint, not an offset from A.

SetAvoid
# SetA
C#
public void SetA(Vector2 a);

First endpoint in local coordinates, initially (0,0). B holds the second endpoint; this is not the Entity’s world position. Use finite distinct endpoints. A change updates the physics shape and emits Changed; repeating a value does not.

Parameters
NameTypeDefault
aVector2—
a

New local A coordinate; finite and distinct from B.

SetBvoid
# SetB
C#
public void SetB(Vector2 b);

Second endpoint in local coordinates, initially (0,10). A point, not a rectangle size or an offset from A. Use a finite value distinct from A. A change emits Changed; repeating a value does not.

Parameters
NameTypeDefault
bVector2—
b

New local B coordinate; finite and distinct from A, not an offset from it.

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.