Table of Contents

Struct Physics2DHit

Namespace
Gravitas.Queries
Assembly
Gravitas.dll

Result from a pure 2D query.

public readonly struct Physics2DHit
Inherited Members

Constructors

Physics2DHit(LSCollider2D, Vector2d, Vector2d, Fixed64)

Creates a 2D query hit from a world-space surface witness.

public Physics2DHit(LSCollider2D collider, Vector2d point, Vector2d normal, Fixed64 distance)

Parameters

collider LSCollider2D
point Vector2d
normal Vector2d
distance Fixed64

Physics2DHit(LSCollider2D, ContactAnchor2D, Vector2d, Fixed64)

Creates a 2D query hit with a rigid-frame surface witness.

public Physics2DHit(LSCollider2D collider, ContactAnchor2D anchor, Vector2d normal, Fixed64 distance)

Parameters

collider LSCollider2D
anchor ContactAnchor2D
normal Vector2d
distance Fixed64

Properties

Anchor

Gets the rigid-frame query witness.

public ContactAnchor2D Anchor { get; }

Property Value

ContactAnchor2D

Body

Gets the collider's body, or null for a bodyless collider.

public SolidBody2D? Body { get; }

Property Value

SolidBody2D

Collider

Gets the collider reported by the query.

public LSCollider2D Collider { get; }

Property Value

LSCollider2D

Distance

Gets the query-specific distance used to rank this hit.

public Fixed64 Distance { get; }

Property Value

Fixed64

Remarks

Rays and sweeps report query travel. Overlaps rank by surface distance, clamped to zero for containment, rather than origin-to-witness distance.

Normal

Gets the world-space surface normal.

public Vector2d Normal { get; }

Property Value

Vector2d

Remarks

For a contained-start ray, this is the target's outward geometric separation normal, independent of ray direction.

Point

Gets the materialized world-space query witness.

public Vector2d Point { get; }

Property Value

Vector2d

Remarks

A contained-start ray reports its start point at zero distance. That point may lie inside the target rather than on its surface.

Exceptions

InvalidOperationException

The conceptual witness lies outside the representable coordinate range.

Methods

TryGetPoint(out Vector2d)

Attempts to materialize the world-space query witness without saturation.

public bool TryGetPoint(out Vector2d point)

Parameters

point Vector2d

Returns

bool