Skip to content

RayCast2D

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

RayCast2D

Back to API Reference

Namespace: Electron2D

Summary

Provides an Electron2D 2D raycast node.

Declaration

public class Electron2D.RayCast2D : Electron2D.Node2D

Remarks

The 0.1.0 Preview baseline stores raycast query settings. Real physics query execution is introduced by the later raycast and shape query task, so result methods return an empty collision state.

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
CollideWithAreas Property Gets or sets whether areas should be considered by the raycast.
CollideWithBodies Property Gets or sets whether bodies should be considered by the raycast.
CollisionMask Property Gets or sets the collision mask used by the raycast.
Enabled Property Gets or sets whether this raycast is enabled.
ExcludeParent Property Gets or sets whether the direct parent should be excluded from results.
HitFromInside Property Gets or sets whether hits are allowed when the ray starts inside a shape.
TargetPosition Property Gets or sets the ray target position in the node's local coordinates.
Electron2D.RayCast2D() Constructor Initializes a new instance of the RayCast2D type.
ForceRaycastUpdate() Method Updates the cached raycast result immediately.
GetCollider() Method Gets the object hit by the raycast.
GetColliderRid() Method Gets the RID of the object hit by the raycast.
GetColliderShape() Method Gets the shape index hit by the raycast.
GetCollisionNormal() Method Gets the collision normal reported by the raycast.
GetCollisionPoint() Method Gets the collision point reported by the raycast.
IsColliding() Method Checks whether the raycast currently collides with an object.

Member Details

CollideWithAreas

Kind: Property

public System.Boolean CollideWithAreas { get; set; }

Summary

Gets or sets whether areas should be considered by the raycast.

Remarks

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

Value

The current collide with areas 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.RayCast2D

CollideWithBodies

Kind: Property

public System.Boolean CollideWithBodies { get; set; }

Summary

Gets or sets whether bodies should be considered by the raycast.

Remarks

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

Value

The current collide with bodies 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.RayCast2D

CollisionMask

Kind: Property

public System.UInt32 CollisionMask { get; set; }

Summary

Gets or sets the collision mask used by the raycast.

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

Enabled

Kind: Property

public System.Boolean Enabled { get; set; }

Summary

Gets or sets whether this raycast is enabled.

Remarks

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

Value

The current enabled 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.RayCast2D

ExcludeParent

Kind: Property

public System.Boolean ExcludeParent { get; set; }

Summary

Gets or sets whether the direct parent should be excluded from results.

Remarks

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

Value

The current exclude parent 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.RayCast2D

HitFromInside

Kind: Property

public System.Boolean HitFromInside { get; set; }

Summary

Gets or sets whether hits are allowed when the ray starts inside a shape.

Remarks

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

Value

The current hit from inside 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.RayCast2D

TargetPosition

Kind: Property

public Electron2D.Vector2 TargetPosition { get; set; }

Summary

Gets or sets the ray target position in the node's local coordinates.

Remarks

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

Value

The current target position 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.RayCast2D

Electron2D.RayCast2D()

Kind: Constructor

public Electron2D.RayCast2D()

Summary

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

ForceRaycastUpdate()

Kind: Method

public System.Void ForceRaycastUpdate()()

Summary

Updates the cached raycast result immediately.

Remarks

Real query execution is not part of the current baseline, so this method keeps the result in an empty state.

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

GetCollider()

Kind: Method

public Electron2D.Object GetCollider()()

Summary

Gets the object hit by the raycast.

Remarks

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

Returns

null until the query backend is implemented.

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

GetColliderRid()

Kind: Method

public Electron2D.Rid GetColliderRid()()

Summary

Gets the RID of the object hit by the raycast.

Remarks

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

Returns

The default empty Electron2D.Rid until the query backend is implemented.

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

GetColliderShape()

Kind: Method

public System.Int32 GetColliderShape()()

Summary

Gets the shape index hit by the raycast.

Remarks

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

Returns

0 until the query backend is implemented.

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

GetCollisionNormal()

Kind: Method

public Electron2D.Vector2 GetCollisionNormal()()

Summary

Gets the collision normal reported by the raycast.

Remarks

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

Returns

Electron2D.Vector2.Zero until the query backend is implemented.

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

GetCollisionPoint()

Kind: Method

public Electron2D.Vector2 GetCollisionPoint()()

Summary

Gets the collision point reported by the raycast.

Remarks

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

Returns

Electron2D.Vector2.Zero until the query backend is implemented.

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

IsColliding()

Kind: Method

public System.Boolean IsColliding()()

Summary

Checks whether the raycast currently collides with an object.

Remarks

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

Returns

false until the query backend is implemented.

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

Clone this wiki locally