SeparationRayShape2D
A specialized +Y ray for contact separation.
SeparationRayShape2D is a contact-separation shape resource, not a standalone RayCast2D. The ray starts at local (0,0) and points toward (0,Length), along +Y. Length defaults to 20. The shape user’s transform sets position and direction. For ordinary world-object ray queries, use RayCast2D or a space query.
SlideOnSlope defaults to false: separation follows the ray axis. When true, the solver directs separation along the hit surface normal. A direct check against a rotated rectangle confirmed that the flag changes the contact pair. This does not establish finished character behavior on steps or slopes: that depends on the body and movement logic.
A ray fully contained inside another shape may produce no contact: the current solver discards that case. This was checked with a length-20 ray inside a 100×100 rectangle. Do not use it as a universal inside-geometry test. Ray–ray pairs also produce no ordinary contact according to source.
Length must be positive and finite; the setter does not perform those checks. Length/SlideOnSlope emit Changed only for a new value. GetRect() includes debug-drawing padding: its width is not the ray’s physical thickness.
For collider use, assign the resource to Shape on CollisionShape2D under a direct CollisionObject2D parent. The resource itself neither finds bodies nor adds them to the world.
Values, notifications, GetRect() padding, +Y direction, contact pairs and SlideOnSlope effects in a direct query were checked. Character movement, continuous collisions, editor interface and images were not tested.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
SeparationRayShape2DConstructor
public SeparationRayShape2D();Creates a specialized separation-ray shape: Length=20, SlideOnSlope=false, local +Y direction. Not RayCast2D or an independent world-object query.
Properties2
LengthProperty
public float Length { get; set; }Length along local +Y from origin (0,0), initially 20. Change direction through the shape transform, not a separate direction property. The setter does not validate positivity or finiteness: validate input and use a positive finite value. A change emits Changed; repeating a value does not.
SlideOnSlopeProperty
public bool SlideOnSlope { get; set; }Initially false: contact separation follows the ray axis. When true, the solver uses the hit surface normal for separation direction, affecting slope sliding. Not an automatic character controller or a change to ray direction. A change emits Changed; repeating a value does not.
Methods4
GetLengthfloat
public float GetLength();Stored ray length along local +Y.
floatStored ray length along local +Y.
GetSlideOnSlopebool
public bool GetSlideOnSlope();Current flag selecting surface-normal-based separation.
boolCurrent flag selecting surface-normal-based separation.
SetLengthvoid
public void SetLength(float length);Length along local +Y from origin (0,0), initially 20. Change direction through the shape transform, not a separate direction property. The setter does not validate positivity or finiteness: validate input and use a positive finite value. A change emits Changed; repeating a value does not.
| Name | Type | Default |
|---|---|---|
length | float | — |
lengthPositive finite ray length in local units.
SetSlideOnSlopevoid
public void SetSlideOnSlope(bool active);Initially false: contact separation follows the ray axis. When true, the solver uses the hit surface normal for separation direction, affecting slope sliding. Not an automatic character controller or a change to ray direction. A change emits Changed; repeating a value does not.
| Name | Type | Default |
|---|---|---|
active | bool | — |
activetrue for surface-normal separation, false for ray-axis separation.