Table of Contents

Struct ShapeCastHit

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

The closest hit of a shape cast from PhysicsQueries2D: the shape and body struck, where, the surface normal there, and how far along the sweep it happened.

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

Constructors

ShapeCastHit(B2ShapeId, B2BodyId, Vector2, Vector2, float)

The closest hit of a shape cast from PhysicsQueries2D: the shape and body struck, where, the surface normal there, and how far along the sweep it happened.

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

Parameters

ShapeId B2ShapeId

The shape that was struck.

BodyId B2BodyId

The body that shape belongs to.

Point Vector2

World-space contact point.

Normal Vector2

World-space surface normal at the contact.

Fraction float

How far along the translation the hit occurred, 0 to 1.

Properties

BodyId

The body that shape belongs to.

public B2BodyId BodyId { get; init; }

Property Value

B2BodyId

Fraction

How far along the translation the hit occurred, 0 to 1.

public float Fraction { get; init; }

Property Value

float

Normal

World-space surface normal at the contact.

public Vector2 Normal { get; init; }

Property Value

Vector2

Point

World-space contact point.

public Vector2 Point { get; init; }

Property Value

Vector2

ShapeId

The shape that was struck.

public B2ShapeId ShapeId { get; init; }

Property Value

B2ShapeId