| | | 1 | | //======================================================================= |
| | | 2 | | // GravitasMixedResponseImpulseDiagnosticView.cs |
| | | 3 | | //======================================================================= |
| | | 4 | | // MIT License, Copyright (c) 2026-present David Oravsky (mrdav30) |
| | | 5 | | // See LICENSE file in the project root for full license information. |
| | | 6 | | //======================================================================= |
| | | 7 | | |
| | | 8 | | using FixedMathSharp; |
| | | 9 | | using Gravitas.Colliders; |
| | | 10 | | |
| | | 11 | | namespace Gravitas.Diagnostics; |
| | | 12 | | |
| | | 13 | | /// <summary> |
| | | 14 | | /// Typed read-only view over a mixed 3D/2D response-impulse diagnostic event. |
| | | 15 | | /// </summary> |
| | | 16 | | public readonly struct GravitasMixedResponseImpulseDiagnosticView |
| | | 17 | | { |
| | 12 | 18 | | internal GravitasMixedResponseImpulseDiagnosticView(GravitasDiagnosticEvent diagnosticEvent) => Event = diagnosticEv |
| | | 19 | | |
| | | 20 | | /// <summary>Gets the underlying diagnostic event.</summary> |
| | | 21 | | public GravitasDiagnosticEvent Event { get; } |
| | | 22 | | |
| | | 23 | | /// <summary>Gets the simulation frame in which the impulse was captured.</summary> |
| | 1 | 24 | | public long Frame => Event.Frame; |
| | | 25 | | |
| | | 26 | | /// <summary>Gets the event's sequence within its capture buffer.</summary> |
| | 1 | 27 | | public int Sequence => Event.Sequence; |
| | | 28 | | |
| | | 29 | | /// <summary>Gets the context-local 3D collider identifier.</summary> |
| | 1 | 30 | | public int Collider3DId => Event.ColliderAId; |
| | | 31 | | |
| | | 32 | | /// <summary>Gets the context-local 2D collider identifier.</summary> |
| | 1 | 33 | | public int Collider2DId => Event.ColliderBId; |
| | | 34 | | |
| | | 35 | | /// <summary>Gets the 3D collider's dimension tag.</summary> |
| | 1 | 36 | | public GravitasColliderDimension Collider3DDimension => Event.ColliderADimension; |
| | | 37 | | |
| | | 38 | | /// <summary>Gets the 2D collider's dimension tag.</summary> |
| | 1 | 39 | | public GravitasColliderDimension Collider2DDimension => Event.ColliderBDimension; |
| | | 40 | | |
| | | 41 | | /// <summary>Gets the 3D collider type.</summary> |
| | 1 | 42 | | public ColliderType Collider3DType => Event.ColliderAType; |
| | | 43 | | |
| | | 44 | | /// <summary>Gets the 2D collider type.</summary> |
| | 1 | 45 | | public ColliderType2D Collider2DType => Event.ColliderB2DType; |
| | | 46 | | |
| | | 47 | | /// <summary>Gets the materialized impulse point on the 3D collider.</summary> |
| | 1 | 48 | | public Vector3d Point3D => Event.PointA; |
| | | 49 | | |
| | | 50 | | /// <summary>Gets the materialized impulse point on the 2D collider.</summary> |
| | 3 | 51 | | public Vector3d Point2D => Event.PointB; |
| | | 52 | | |
| | | 53 | | /// <summary>Gets whether <see cref="Point3D"/> contains a materialized point.</summary> |
| | 1 | 54 | | public bool HasPoint3D => Event.HasPointA; |
| | | 55 | | |
| | | 56 | | /// <summary>Gets whether <see cref="Point2D"/> contains a materialized point.</summary> |
| | 1 | 57 | | public bool HasPoint2D => Event.HasPointB; |
| | | 58 | | |
| | | 59 | | /// <summary>Gets the applied impulse.</summary> |
| | 3 | 60 | | public Vector3d Impulse => Event.Vector; |
| | | 61 | | |
| | | 62 | | /// <summary>Gets the magnitude of the applied impulse.</summary> |
| | 1 | 63 | | public Fixed64 ImpulseMagnitude => Event.ScalarA; |
| | | 64 | | |
| | | 65 | | /// <summary>Gets the relative normal velocity used by the response.</summary> |
| | 1 | 66 | | public Fixed64 NormalVelocity => Event.ScalarB; |
| | | 67 | | |
| | | 68 | | /// <summary>Gets the response iteration that applied the impulse.</summary> |
| | 2 | 69 | | public int Iteration => Event.DataA; |
| | | 70 | | |
| | | 71 | | /// <summary>Gets the configured response iteration limit.</summary> |
| | 9 | 72 | | public int IterationLimit => Event.DataB; |
| | | 73 | | } |