| | | 1 | | //======================================================================= |
| | | 2 | | // GravitasForceDeltaDiagnosticView.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 force-delta diagnostic event. |
| | | 15 | | /// </summary> |
| | | 16 | | public readonly struct GravitasForceDeltaDiagnosticView |
| | | 17 | | { |
| | 4 | 18 | | internal GravitasForceDeltaDiagnosticView(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 force was captured.</summary> |
| | 1 | 24 | | public long Frame => Event.Frame; |
| | | 25 | | |
| | | 26 | | /// <summary>Gets the event's sequence within its capture buffer.</summary> |
| | 2 | 27 | | public int Sequence => Event.Sequence; |
| | | 28 | | |
| | | 29 | | /// <summary>Gets the context-local body identifier.</summary> |
| | 1 | 30 | | public int BodyId => Event.BodyId; |
| | | 31 | | |
| | | 32 | | /// <summary>Gets the body's context-local collider identifier.</summary> |
| | 1 | 33 | | public int ColliderId => Event.ColliderAId; |
| | | 34 | | |
| | | 35 | | /// <summary>Gets the body's collider type.</summary> |
| | 1 | 36 | | public ColliderType ColliderType => Event.ColliderAType; |
| | | 37 | | |
| | | 38 | | /// <summary>Gets the applied force.</summary> |
| | 3 | 39 | | public Vector3d Force => Event.Vector; |
| | | 40 | | |
| | | 41 | | /// <summary>Gets the resulting acceleration delta.</summary> |
| | 1 | 42 | | public Vector3d AccelerationDelta => Event.PointA; |
| | | 43 | | |
| | | 44 | | /// <summary>Gets the magnitude of the applied force.</summary> |
| | 1 | 45 | | public Fixed64 ForceMagnitude => Event.ScalarA; |
| | | 46 | | } |