Skip to content

CollisionObject2D

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

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

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

Overview

Provides the Electron2D base node for 2D objects that own a physics server RID.

Syntax

public abstract class Electron2D.CollisionObject2D : Electron2D.Node2D

Godot 4.7 C# profile compatibility

Profile: Electron2D 0.1.0 2D
Status: Partial / Not verified
Out of profile: yes
Godot reference: CollisionObject2D

Base collision object with GetRid(), collision layer/mask storage, RID lifecycle and transform sync.

Remarks

CollisionObject2D creates its RID when it enters a Electron2D.SceneTree and frees it when it exits the tree. The RID is an Electron2D Electron2D.Rid, not a Box2D.NET handle.

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.

Members

Member Kind Summary
CollisionLayer Property Gets or sets the collision layer bits for this object.
CollisionMask Property Gets or sets the collision mask bits used by this object.
Electron2D.CollisionObject2D() Constructor Initializes a new instance of the CollisionObject2D type.
GetCollisionLayerValue(System.Int32) Method Checks whether an Electron2D collision layer number is enabled.
GetCollisionMaskValue(System.Int32) Method Checks whether an Electron2D collision mask number is enabled.
GetRid() Method Gets the physics server RID owned by this collision object.
SetCollisionLayerValue(System.Int32, System.Boolean) Method Enables or disables an Electron2D collision layer number.
SetCollisionMaskValue(System.Int32, System.Boolean) Method Enables or disables an Electron2D collision mask number.

Member Details

CollisionLayer

Kind: Property

public System.UInt32 CollisionLayer { get; set; }

Summary

Gets or sets the collision layer bits for this object.

Remarks

This property follows the validation and lifetime rules of its declaring type.

Value

The current collision layer value.

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.CollisionObject2D

CollisionMask

Kind: Property

public System.UInt32 CollisionMask { get; set; }

Summary

Gets or sets the collision mask bits used by this object.

Remarks

This property follows the validation and lifetime rules of its declaring type.

Value

The current collision mask value.

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.CollisionObject2D

Electron2D.CollisionObject2D()

Kind: Constructor

public Electron2D.CollisionObject2D()

Summary

Initializes a new instance of the CollisionObject2D 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.CollisionObject2D

GetCollisionLayerValue(System.Int32)

Kind: Method

public System.Boolean GetCollisionLayerValue(System.Int32)(System.Int32 layerNumber)

Summary

Checks whether an Electron2D collision layer number is enabled.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Parameters

  • layerNumber: The layer number in the inclusive range 1..32.

Returns

true when the layer bit is enabled; otherwise, false.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.CollisionObject2D

GetCollisionMaskValue(System.Int32)

Kind: Method

public System.Boolean GetCollisionMaskValue(System.Int32)(System.Int32 layerNumber)

Summary

Checks whether an Electron2D collision mask number is enabled.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Parameters

  • layerNumber: The mask layer number in the inclusive range 1..32.

Returns

true when the mask bit is enabled; otherwise, false.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.CollisionObject2D

GetRid()

Kind: Method

public Electron2D.Rid GetRid()()

Summary

Gets the physics server RID owned by this collision object.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Returns

The current physics server RID, or the default empty Electron2D.Rid when the node is not inside a Electron2D.SceneTree.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.CollisionObject2D

SetCollisionLayerValue(System.Int32, System.Boolean)

Kind: Method

public System.Void SetCollisionLayerValue(System.Int32, System.Boolean)(System.Int32 layerNumber, System.Boolean value)

Summary

Enables or disables an Electron2D collision layer number.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Parameters

  • layerNumber: The layer number in the inclusive range 1..32.
  • value: Whether the layer bit should be enabled.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.CollisionObject2D

SetCollisionMaskValue(System.Int32, System.Boolean)

Kind: Method

public System.Void SetCollisionMaskValue(System.Int32, System.Boolean)(System.Int32 layerNumber, System.Boolean value)

Summary

Enables or disables an Electron2D collision mask number.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Parameters

  • layerNumber: The mask layer number in the inclusive range 1..32.
  • value: Whether the mask bit should be enabled.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.CollisionObject2D

Clone this wiki locally