PhysicsAPI reference
Struct RayHit
Namespace: MicroEngine.Physics
Assembly: MicroEngine.Physics.dll
Guide: Physics worlds
The closest shape a ray hit (RayCast).
public readonly struct RayHit : IEquatable<RayHit>Implements
Constructors
RayHit(ShapeId, EntityId, Vector2, Vector2, float)
The closest shape a ray hit (RayCast).
public RayHit(ShapeId Shape, EntityId Owner, Vector2 Point, Vector2 Normal, float Fraction)Parameters
Shape ShapeId
The shape hit.
Owner EntityId
The entity owning that shape’s body.
Point Vector2
Where the ray entered it.
Normal Vector2
The surface normal there, unit length, facing the ray’s origin.
Fraction float
How far along the ray, from 0 (its start) to 1 (its end).
Properties
Fraction
How far along the ray, from 0 (its start) to 1 (its end).
public float Fraction { get; init; }Property Value
Normal
The surface normal there, unit length, facing the ray’s origin.
public Vector2 Normal { get; init; }Property Value
Owner
The entity owning that shape’s body.
public EntityId Owner { get; init; }Property Value
Point
Where the ray entered it.
public Vector2 Point { get; init; }Property Value
Shape
The shape hit.
public ShapeId Shape { get; init; }Property Value
Methods
Deconstruct(out ShapeId, out EntityId, out Vector2, out Vector2, out float)
public void Deconstruct(out ShapeId Shape, out EntityId Owner, out Vector2 Point, out Vector2 Normal, out float Fraction)Parameters
Shape ShapeId
Owner EntityId
Point Vector2
Normal Vector2
Fraction float
Equals(object)
public override bool Equals(object obj)Parameters
obj object
Returns
Equals(RayHit)
public bool Equals(RayHit other)Parameters
other RayHit
Returns
GetHashCode()
public override int GetHashCode()Returns
ToString()
public override string ToString()Returns
Operators
operator ==(RayHit, RayHit)
public static bool operator ==(RayHit left, RayHit right)Parameters
left RayHit
right RayHit
Returns
operator !=(RayHit, RayHit)
public static bool operator !=(RayHit left, RayHit right)Parameters
left RayHit
right RayHit