Table of Contents

Struct QueryRaycastHit

Namespace
Stride.CommunityToolkit.Box2D
Assembly
Stride.CommunityToolkit.Box2D.dll

A raw 2D raycast hit returned by PhysicsQueries2D. Engine-agnostic: contains only Box2D identifiers and value types; see RaycastHit for the entity-resolved variant.

public readonly record struct QueryRaycastHit : IEquatable<QueryRaycastHit>
Implements
Inherited Members

Constructors

QueryRaycastHit(B2BodyId, B2ShapeId, Vector2, Vector2, float)

A raw 2D raycast hit returned by PhysicsQueries2D. Engine-agnostic: contains only Box2D identifiers and value types; see RaycastHit for the entity-resolved variant.

public QueryRaycastHit(B2BodyId BodyId, B2ShapeId ShapeId, Vector2 Point, Vector2 Normal, float Fraction)

Parameters

BodyId B2BodyId

The body hit by the ray.

ShapeId B2ShapeId

The specific shape on the body that was hit.

Point Vector2

World-space intersection point.

Normal Vector2

World-space surface normal at the hit.

Fraction float

Normalized fraction along the ray in range [0,1].

Properties

BodyId

The body hit by the ray.

public B2BodyId BodyId { get; init; }

Property Value

B2BodyId

Fraction

Normalized fraction along the ray in range [0,1].

public float Fraction { get; init; }

Property Value

float

Normal

World-space surface normal at the hit.

public Vector2 Normal { get; init; }

Property Value

Vector2

Point

World-space intersection point.

public Vector2 Point { get; init; }

Property Value

Vector2

ShapeId

The specific shape on the body that was hit.

public B2ShapeId ShapeId { get; init; }

Property Value

B2ShapeId