Skip to content

CollisionShape2D

Eduard Gushchin edited this page Jun 21, 2026 · 5 revisions

Home | API by Category | Complete API Index | API Compatibility

Field Value
Full name Electron2D.CollisionShape2D
Namespace Electron2D
Kind class
Category Physics

Overview

Provides a node that attaches a Electron2D.Shape2D to a collision object.

Syntax

public class Electron2D.CollisionShape2D : Electron2D.Node2D

Remarks

This node stores a shape resource reference and validates shape placement rules when it enters a Electron2D.SceneTree.

Thread Safety

This type is not synchronized. Create and mutate nodes on the main scene thread.

Since

This type is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.CollisionObject2D
  • Electron2D.Shape2D

Members

Member Kind Summary
DebugColor Property Gets or sets the color used for collision shape debug visualization.
Disabled Property Gets or sets whether the shape is disabled.
OneWayCollision Property Gets or sets whether the shape should act as a one-way collision shape.
OneWayCollisionMargin Property Gets or sets the one-way collision margin.
Shape Property Gets or sets the shape resource attached by this node.
Electron2D.CollisionShape2D() Constructor Initializes a new instance of the CollisionShape2D type.

Member Details

DebugColor

Kind: Property

public Electron2D.Color DebugColor { get; set; }

Summary

Gets or sets the color used for collision shape debug visualization.

Remarks

This value is consumed by the internal debug collision shape snapshot when Electron2D.SceneTree.DebugCollisionsHint is enabled.

The property stores only managed color data and does not expose renderer or physics backend handles.

Value

The override color. Electron2D.Color.Transparent means that the engine default debug color should be used.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.SceneTree.DebugCollisionsHint

Disabled

Kind: Property

public System.Boolean Disabled { get; set; }

Summary

Gets or sets whether the shape is disabled.

Remarks

Disabled shapes do not participate in overlap, query or motion checks. They can still be present in debug visualization snapshots so the editor can show that the shape exists but is inactive.

Value

true when the shape should be ignored by physics checks; otherwise, false.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.CollisionShape2D.Shape

OneWayCollision

Kind: Property

public System.Boolean OneWayCollision { get; set; }

Summary

Gets or sets whether the shape should act as a one-way collision shape.

Remarks

The current managed motion baseline uses this value for downward movement against static shapes.

Value

true to make the shape one-way for supported motion checks; otherwise, false.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.CollisionShape2D.OneWayCollisionMargin

OneWayCollisionMargin

Kind: Property

public System.Single OneWayCollisionMargin { get; set; }

Summary

Gets or sets the one-way collision margin.

Remarks

Higher values make one-way collision more tolerant for fast movement.

Value

The margin in world units used by one-way collision checks.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.CollisionShape2D.OneWayCollision

Shape

Kind: Property

public Electron2D.Shape2D Shape { get; set; }

Summary

Gets or sets the shape resource attached by this node.

Remarks

The 0.1.0 Preview baseline uses this resource for managed AABB overlap, query, motion and debug visualization snapshots.

Value

The assigned Electron2D.Shape2D resource, or null when this node has no collision geometry.

Exceptions

  • System.InvalidOperationException: Thrown when a Electron2D.ConcavePolygonShape2D is assigned under a collision owner that is not a Electron2D.StaticBody2D.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.CollisionShape2D.DebugColor

Electron2D.CollisionShape2D()

Kind: Constructor

public Electron2D.CollisionShape2D()

Summary

Initializes a new instance of the CollisionShape2D type.

Remarks

The new instance follows the lifetime and validation rules of its declaring type.

Thread Safety

This member is not synchronized. Call it from the thread that owns the related object unless the declaring type states otherwise.

Since

This API is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.CollisionShape2D

Clone this wiki locally