reckfellENGINE

WorldBoundaryShape2D

An infinite line and solid half-space with an outward normal.

On this page
class WorldBoundaryShape2DReckfellSharpInherits Shape2D

WorldBoundaryShape2D defines an infinite boundary rather than a finite platform. Normal points from the solid half-space toward the free side; its default is (0,-1). Distance starts at 0. With a unit Normal, the line satisfies Normal.Dot(point)=Distance and the solid side is Normal.Dot(point)<Distance.

In 2D, +Y points downward. Therefore Normal=(0,-1), Distance=0 defines ground at y=0 with the solid region below. Ground at y=5 requires Distance=-5. This executed helper creates that local boundary and rejects NaN or infinite y. The caller owns the resource:

C#
using System;
using Reckfell;

public static class BoundaryFactory2D
{
    // Local horizontal boundary at y; solid half-space is below it (+Y).
    // The caller owns the resource. This does not create a physics body.
    public static WorldBoundaryShape2D Ground(float y)
    {
        if (!float.IsFinite(y))
            throw new ArgumentOutOfRangeException(nameof(y));
        return new WorldBoundaryShape2D
        {
            Normal = Vector2.Up,
            Distance = -y
        };
    }
}

The normal should be finite and unit length. The setter rejects zero/approximately zero vectors but does not normalize others: assigning (0,-2) reads back as (0,-2). Without a unit normal, the simple distance interpretation no longer holds. For rightward Normal=(1,0), Distance=5 places the line at x=5 with the solid side on the left.

GetRect() returns finite diagnostic-line/arrow bounds. They do not limit the physical half-space: the checked circle at x=100000 still collided with ground far beyond this Rect2. Use another shape for a finite platform.

Normal/Distance and their corresponding methods update the same geometry, emitting Changed only for a new value. For physics-world use, assign the resource to Shape on CollisionShape2D, which must be a direct child Entity of CollisionObject2D. Creating a resource adds no body.

Defaults, unnormalized-vector storage, notifications, both boundary sides, Distance sign, infinite extent beyond debug bounds and the exact helper were checked. These checks do not establish body movement, one-way platforms, arbitrary transforms or image quality.

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

Constructors1

WorldBoundaryShape2DConstructor
# WorldBoundaryShape2D
C#
public WorldBoundaryShape2D();

Creates an infinite boundary with Normal=(0,-1), Distance=0. In local coordinates the free side is above and the solid side is toward +Y. Creates no physics body.

Properties2

DistanceProperty
# Distance
C#
public float Distance { get; set; }

Signed offset along unit Normal, initially 0. With a unit normal, the line is Normal.Dot(point)=Distance and the solid side is below Distance. For Normal=(0,-1), ground at y=5 requires Distance=-5. The setter does not validate finiteness; validate input. A change emits Changed; repeating a value does not.

NormalProperty
# Normal
C#
public Vector2 Normal { get; set; }

Local normal, initially (0,-1), pointing from the solid half-space toward the free side. Zero or approximately zero vectors are rejected. Nonzero input is stored without automatic normalization; supply a finite unit normal so Distance acts as signed distance. A change emits Changed; repeating a value does not.

Methods4

GetDistancefloat
# GetDistance
C#
public float GetDistance();

Stored signed offset; interpret it with a unit Normal.

Returns float

Stored signed offset; interpret it with a unit Normal.

GetNormalVector2
# GetNormal
C#
public Vector2 GetNormal();

Stored local normal without automatic normalization.

Returns Vector2

Stored local normal without automatic normalization.

SetDistancevoid
# SetDistance
C#
public void SetDistance(float distance);

Signed offset along unit Normal, initially 0. With a unit normal, the line is Normal.Dot(point)=Distance and the solid side is below Distance. For Normal=(0,-1), ground at y=5 requires Distance=-5. The setter does not validate finiteness; validate input. A change emits Changed; repeating a value does not.

Parameters
NameTypeDefault
distancefloat—
distance

Finite signed offset along unit Normal; may be negative.

SetNormalvoid
# SetNormal
C#
public void SetNormal(Vector2 normal);

Local normal, initially (0,-1), pointing from the solid half-space toward the free side. Zero or approximately zero vectors are rejected. Nonzero input is stored without automatic normalization; supply a finite unit normal so Distance acts as signed distance. A change emits Changed; repeating a value does not.

Parameters
NameTypeDefault
normalVector2—
normal

Finite unit normal pointing from the solid side toward the free side. The setter does not normalize input.

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.