2024-01-25 12:46:43 +03:00
|
|
|
using Syntriax.Engine.Core;
|
|
|
|
using Syntriax.Engine.Physics2D.Abstract;
|
|
|
|
|
|
|
|
namespace Syntriax.Engine.Physics2D;
|
|
|
|
|
2024-01-27 00:51:34 +03:00
|
|
|
[System.Diagnostics.DebuggerDisplay("Normal: {Normal.ToString(), nq}, Penetration: {Penetration}")]
|
2024-01-26 23:40:02 +03:00
|
|
|
public readonly struct CollisionDetectionInformation
|
2024-01-25 12:46:43 +03:00
|
|
|
(
|
2024-11-03 20:25:28 +03:00
|
|
|
ICollider2D Detector,
|
|
|
|
ICollider2D Detected,
|
2024-01-25 12:46:43 +03:00
|
|
|
Vector2D Normal,
|
|
|
|
float Penetration
|
2024-01-26 23:40:02 +03:00
|
|
|
)
|
|
|
|
{
|
2024-11-03 20:25:28 +03:00
|
|
|
public ICollider2D Detector { get; init; } = Detector;
|
|
|
|
public ICollider2D Detected { get; init; } = Detected;
|
2024-01-26 23:40:02 +03:00
|
|
|
public Vector2D Normal { get; init; } = Normal;
|
|
|
|
public float Penetration { get; init; } = Penetration;
|
2024-11-03 20:25:28 +03:00
|
|
|
|
|
|
|
public CollisionDetectionInformation Reverse() => new(Detected, Detector, -Normal, Penetration);
|
2024-01-26 23:40:02 +03:00
|
|
|
}
|