reckfellENGINE

CollisionShape2D

Attaches a shape resource to a 2D body or area.

On this page
class CollisionShape2DReckfellSharpInherits Entity2D

CollisionShape2D must be a direct child of a suitable CollisionObject. Shape is shared: resizing a common resource affects every instance using it. Assign a Duplicate before editing independent geometry.

Change resource dimensions with unit scale in the physics branch, including inherited scale checks. Disabled removes the shape from physics participation after application. Use SetDeferred inside a physics signal rather than immediate restructuring. Hiding the visible model does not disable collision.

Guide and example.

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

Constructors1

CollisionShape2DConstructor
# CollisionShape2D
C#
public CollisionShape2D();

Properties6

DebugColorProperty
# DebugColor
C#
public Color DebugColor { get; set; }

The collision shape color that is displayed in the editor, or in the running project if Debug > Visible Collision Shapes is checked at the top of the editor. Note: The default value is ProjectSettings.debug/shapes/collision/shape_color. The Color(0, 0, 0, 0) value documented here is a placeholder, and not the actual default debug color.

DisabledProperty
# Disabled
C#
public bool Disabled { get; set; }

Excludes the shape from physics participation after application. Use SetDeferred from a physics callback; hiding artwork does not substitute for this flag.

OneWayCollisionProperty
# OneWayCollision
C#
public bool OneWayCollision { get; set; }

Sets whether this collision shape should only detect collision on one side (top or bottom). Note: This property has no effect if this CollisionShape2D is a child of an Area2D node. Note: The one way collision direction can be configured by setting CollisionShape2D.OneWayCollisionDirection.

OneWayCollisionDirectionProperty
# OneWayCollisionDirection
C#
public Vector2 OneWayCollisionDirection { get; set; }

The direction used for one-way collision.

OneWayCollisionMarginProperty
# OneWayCollisionMargin
C#
public float OneWayCollisionMargin { get; set; }

The margin used for one-way collision (in pixels). Higher values will make the shape thicker, and work better for colliders that enter the shape at a high velocity.

ShapeProperty
# Shape
C#
public Shape2D Shape { get; set; }

A geometry resource that can be shared across instances. Resizing affects all users; assign a Duplicate first for an independent collider.

Methods12

GetDebugColorColor
# GetDebugColor
C#
public Color GetDebugColor();
Returns Color
GetOneWayCollisionDirectionVector2
# GetOneWayCollisionDirection
C#
public Vector2 GetOneWayCollisionDirection();
Returns Vector2
GetOneWayCollisionMarginfloat
# GetOneWayCollisionMargin
C#
public float GetOneWayCollisionMargin();
Returns float
GetShapeShape2D
# GetShape
C#
public Shape2D GetShape();
Returns Shape2D
IsDisabledbool
# IsDisabled
C#
public bool IsDisabled();
Returns bool
IsOneWayCollisionEnabledbool
# IsOneWayCollisionEnabled
C#
public bool IsOneWayCollisionEnabled();
Returns bool
SetDebugColorvoid
# SetDebugColor
C#
public void SetDebugColor(Color color);
Parameters
NameTypeDefault
colorColor—
SetDisabledvoid
# SetDisabled
C#
public void SetDisabled(bool disabled);
Parameters
NameTypeDefault
disabledbool—
SetOneWayCollisionvoid
# SetOneWayCollision
C#
public void SetOneWayCollision(bool enabled);
Parameters
NameTypeDefault
enabledbool—
SetOneWayCollisionDirectionvoid
# SetOneWayCollisionDirection
C#
public void SetOneWayCollisionDirection(Vector2 direction);
Parameters
NameTypeDefault
directionVector2—
SetOneWayCollisionMarginvoid
# SetOneWayCollisionMargin
C#
public void SetOneWayCollisionMargin(float margin);
Parameters
NameTypeDefault
marginfloat—
SetShapevoid
# SetShape
C#
public void SetShape(Shape2D shape);
Parameters
NameTypeDefault
shapeShape2D—
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.