| | | 1 | | //======================================================================= |
| | | 2 | | // GravitasVelocityDeltaDiagnosticView.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 linear or angular velocity diagnostic events. |
| | | 15 | | /// </summary> |
| | | 16 | | public readonly struct GravitasVelocityDeltaDiagnosticView |
| | | 17 | | { |
| | 7 | 18 | | internal GravitasVelocityDeltaDiagnosticView(GravitasDiagnosticEvent diagnosticEvent) => Event = diagnosticEvent; |
| | | 19 | | |
| | | 20 | | /// <summary>Gets the underlying diagnostic event.</summary> |
| | | 21 | | public GravitasDiagnosticEvent Event { get; } |
| | | 22 | | |
| | | 23 | | /// <summary>Gets the simulation frame in which the velocity change 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 whether the event describes linear or angular velocity.</summary> |
| | 2 | 30 | | public GravitasDiagnosticEventKind Kind => Event.Kind; |
| | | 31 | | |
| | | 32 | | /// <summary>Gets the context-local body identifier.</summary> |
| | 2 | 33 | | public int BodyId => Event.BodyId; |
| | | 34 | | |
| | | 35 | | /// <summary>Gets the body's context-local collider identifier.</summary> |
| | 2 | 36 | | public int ColliderId => Event.ColliderAId; |
| | | 37 | | |
| | | 38 | | /// <summary>Gets the body's collider type.</summary> |
| | 2 | 39 | | public ColliderType ColliderType => Event.ColliderAType; |
| | | 40 | | |
| | | 41 | | /// <summary>Gets the velocity before the change.</summary> |
| | 2 | 42 | | public Vector3d Before => Event.Start; |
| | | 43 | | |
| | | 44 | | /// <summary>Gets the velocity after the change.</summary> |
| | 2 | 45 | | public Vector3d After => Event.End; |
| | | 46 | | |
| | | 47 | | /// <summary>Gets the velocity delta.</summary> |
| | 3 | 48 | | public Vector3d Delta => Event.Vector; |
| | | 49 | | |
| | | 50 | | /// <summary>Gets the magnitude of the resulting velocity.</summary> |
| | 2 | 51 | | public Fixed64 ResultSpeed => Event.ScalarA; |
| | | 52 | | } |