Struct ShapeCastHit
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
ShapeIdB2ShapeIdThe shape that was struck.
BodyIdB2BodyIdThe body that shape belongs to.
PointVector2World-space contact point.
NormalVector2World-space surface normal at the contact.
FractionfloatHow 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
Normal
World-space surface normal at the contact.
public Vector2 Normal { get; init; }
Property Value
Point
World-space contact point.
public Vector2 Point { get; init; }
Property Value
ShapeId
The shape that was struck.
public B2ShapeId ShapeId { get; init; }
Property Value
- B2ShapeId