Skip to content

KinematicCollision2D

Eduard Gushchin edited this page Jul 1, 2026 · 5 revisions

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

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

Overview

Holds collision data returned by 2D body movement methods.

Syntax

public class Electron2D.KinematicCollision2D : Electron2D.RefCounted

Godot 4.7 C# profile compatibility

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

Collision result object returned by body movement methods, with collider, normal, travel, remainder and velocity data.

Remarks

The 0.1.0 Preview baseline stores collision information produced by the managed AABB kinematic solver. It does not expose backend-specific handles.

Thread Safety

This type is not synchronized. Read it on the main scene thread.

Since

This type is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.CharacterBody2D.MoveAndSlide
  • Electron2D.PhysicsBody2D.MoveAndCollide(Electron2D.Vector2,System.Boolean,System.Single,System.Boolean)

Members

Member Kind Summary
GetAngle(Electron2D.Vector2?) Method Gets the collision angle relative to an up direction.
GetCollider() Method Gets the object collided with by the moving body.
GetColliderId() Method Gets the instance ID of the object collided with by the moving body.
GetColliderRid() Method Gets the physics server RID of the collider.
GetColliderShape() Method Gets the collider shape object involved in the collision.
GetColliderShapeIndex() Method Gets the collider shape index involved in the collision.
GetColliderVelocity() Method Gets the velocity reported for the collider.
GetDepth() Method Gets the overlap depth along the collision normal.
GetLocalShape() Method Gets the moving body's local shape object involved in the collision.
GetNormal() Method Gets the collision normal.
GetPosition() Method Gets the collision position in global coordinates.
GetRemainder() Method Gets the remaining motion after the collision.
GetTravel() Method Gets the motion completed before the collision.

Member Details

GetAngle(Electron2D.Vector2?)

Kind: Method

public System.Single GetAngle(Electron2D.Vector2?)(Electron2D.Vector2? upDirection)

Summary

Gets the collision angle relative to an up direction.

Remarks

When upDirection is null, Electron2D.Vector2.Up is used as the reference direction.

Parameters

  • upDirection: The up direction used as the reference vector. When omitted, Electron2D.Vector2.Up is used.

Returns

The positive angle in radians between the collision normal and the up direction.

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.KinematicCollision2D.GetNormal

GetCollider()

Kind: Method

public Electron2D.Object GetCollider()()

Summary

Gets the object collided with by the moving body.

Remarks

The current movement baseline reports Electron2D.StaticBody2D colliders.

Returns

The collider object, or null when the collision has no collider.

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.KinematicCollision2D.GetColliderRid
  • Electron2D.KinematicCollision2D.GetColliderShape

GetColliderId()

Kind: Method

public System.Int64 GetColliderId()()

Summary

Gets the instance ID of the object collided with by the moving body.

Remarks

The value matches Electron2D.Object.GetInstanceId for the object returned by Electron2D.KinematicCollision2D.GetCollider.

Returns

The collider instance ID, or 0 when the collision has no collider.

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.KinematicCollision2D.GetCollider

GetColliderRid()

Kind: Method

public Electron2D.Rid GetColliderRid()()

Summary

Gets the physics server RID of the collider.

Remarks

The RID is an opaque identifier. It should be passed only to APIs that explicitly accept Electron2D.Rid.

Returns

The collider RID, or the empty RID when the collision has no collider.

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.KinematicCollision2D.GetCollider

GetColliderShape()

Kind: Method

public Electron2D.Object GetColliderShape()()

Summary

Gets the collider shape object involved in the collision.

Remarks

The returned object is the Electron2D.CollisionShape2D that provided the target bounds for the sweep.

Returns

The collider shape object, or null when unavailable.

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.KinematicCollision2D.GetColliderShapeIndex

GetColliderShapeIndex()

Kind: Method

public System.Int32 GetColliderShapeIndex()()

Summary

Gets the collider shape index involved in the collision.

Remarks

The 0.1.0 Preview baseline reports the index within the collider's active collision shapes collected for the movement query.

Returns

The collider shape index.

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.KinematicCollision2D.GetColliderShape

GetColliderVelocity()

Kind: Method

public Electron2D.Vector2 GetColliderVelocity()()

Summary

Gets the velocity reported for the collider.

Remarks

For Electron2D.StaticBody2D colliders this value is Electron2D.StaticBody2D.ConstantLinearVelocity.

Returns

The collider velocity.

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.CharacterBody2D.GetPlatformVelocity

GetDepth()

Kind: Method

public System.Single GetDepth()()

Summary

Gets the overlap depth along the collision normal.

Remarks

The current movement baseline reports swept collisions rather than persistent overlap recovery, so this value is 0.

Returns

The overlap depth. The AABB baseline returns 0 for swept collisions.

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.KinematicCollision2D.GetNormal

GetLocalShape()

Kind: Method

public Electron2D.Object GetLocalShape()()

Summary

Gets the moving body's local shape object involved in the collision.

Remarks

The returned object is the moving body's Electron2D.CollisionShape2D used for the sweep.

Returns

The local shape object, or null when unavailable.

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.KinematicCollision2D.GetColliderShape

GetNormal()

Kind: Method

public Electron2D.Vector2 GetNormal()()

Summary

Gets the collision normal.

Remarks

The normal points away from the collider and is used by Electron2D.CharacterBody2D.MoveAndSlide to remove the velocity component that moves into the collision.

Returns

The collision normal.

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.KinematicCollision2D.GetAngle(System.Nullable{Electron2D.Vector2})
  • Electron2D.KinematicCollision2D.GetTravel

GetPosition()

Kind: Method

public Electron2D.Vector2 GetPosition()()

Summary

Gets the collision position in global coordinates.

Remarks

In the managed AABB baseline this is the swept center point on the expanded bounds used to stop the moving body.

Returns

The collision position.

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.KinematicCollision2D.GetTravel

GetRemainder()

Kind: Method

public Electron2D.Vector2 GetRemainder()()

Summary

Gets the remaining motion after the collision.

Remarks

Electron2D.CharacterBody2D.MoveAndSlide slides this value along the collision normal to continue movement after a hit.

Returns

The motion that remained after travel was consumed.

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.KinematicCollision2D.GetNormal
  • Electron2D.KinematicCollision2D.GetTravel

GetTravel()

Kind: Method

public Electron2D.Vector2 GetTravel()()

Summary

Gets the motion completed before the collision.

Remarks

For non-test movement, the moving body has already been advanced by this vector when the collision is returned.

Returns

The travel motion before the body stopped or slid.

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.KinematicCollision2D.GetRemainder
  • Electron2D.PhysicsBody2D.MoveAndCollide(Electron2D.Vector2,System.Boolean,System.Single,System.Boolean)

Clone this wiki locally