Syntriax.Engine/Engine.Physics2D/CollisionDetectionInformati...

22 lines
696 B
C#
Raw Normal View History

using Syntriax.Engine.Core;
using Syntriax.Engine.Physics2D.Abstract;
namespace Syntriax.Engine.Physics2D;
[System.Diagnostics.DebuggerDisplay("Normal: {Normal.ToString(), nq}, Penetration: {Penetration}")]
public readonly struct CollisionDetectionInformation
(
ICollider2D Detector,
ICollider2D Detected,
Vector2D Normal,
float Penetration
)
{
public ICollider2D Detector { get; init; } = Detector;
public ICollider2D Detected { get; init; } = Detected;
public Vector2D Normal { get; init; } = Normal;
public float Penetration { get; init; } = Penetration;
public CollisionDetectionInformation Reverse() => new(Detected, Detector, -Normal, Penetration);
}