Scripting API

Scripting API

RaycastHit2D

Record struct in Abyss.Physics2D, from Abyss.Physics2D.

What a ray or a swept shape hit first: see Physics2D.Raycast.

public readonly record struct RaycastHit2D

Constructors

RaycastHit2D

public RaycastHit2D(ulong Entity, ulong Collider, Vector2 Point, Vector2 Normal, float Distance)

What a ray or a swept shape hit first: see Physics2D.Raycast.

Parameters

  • Entity: The body whose collider it hit: an entity with a Rigidbody 2D, or ground.
  • Collider: The entity of the collider it hit: Entity itself, or one under it.
  • Point: Where, in world space.
  • Normal: The normal of the surface there, a unit long, pointing out of it toward where the ray came from.
  • Distance: How far it went to get there, in meters.

Properties

Entity

public ulong Entity { get; init; }

The body whose collider it hit: an entity with a Rigidbody 2D, or ground.

Collider

public ulong Collider { get; init; }

The entity of the collider it hit: Entity itself, or one under it.

Point

public Vector2 Point { get; init; }

Where, in world space.

Normal

public Vector2 Normal { get; init; }

The normal of the surface there, a unit long, pointing out of it toward where the ray came from.

Distance

public float Distance { get; init; }

How far it went to get there, in meters.