| | | 1 | | //======================================================================= |
| | | 2 | | // JointSolveMetrics3D.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 | | |
| | | 10 | | namespace Gravitas.Constraints; |
| | | 11 | | |
| | | 12 | | /// <summary> |
| | | 13 | | /// Deterministic metrics captured from the most recent 3D joint solver pass. |
| | | 14 | | /// </summary> |
| | | 15 | | public readonly struct JointSolveMetrics3D |
| | | 16 | | { |
| | | 17 | | internal JointSolveMetrics3D( |
| | | 18 | | int preparedRowCount, |
| | | 19 | | Fixed64 linearAnchorErrorMagnitude, |
| | | 20 | | Fixed64 angularLimitErrorMagnitude, |
| | | 21 | | Fixed64 accumulatedImpulseMagnitude, |
| | | 22 | | Fixed64 incrementalImpulseMagnitude, |
| | | 23 | | Fixed64 motorImpulseMagnitude, |
| | | 24 | | Fixed64 motorErrorMagnitude, |
| | | 25 | | int clampedRowCount) |
| | | 26 | | { |
| | 49731 | 27 | | PreparedRowCount = preparedRowCount; |
| | 49731 | 28 | | LinearAnchorErrorMagnitude = linearAnchorErrorMagnitude; |
| | 49731 | 29 | | AngularLimitErrorMagnitude = angularLimitErrorMagnitude; |
| | 49731 | 30 | | AccumulatedImpulseMagnitude = accumulatedImpulseMagnitude; |
| | 49731 | 31 | | IncrementalImpulseMagnitude = incrementalImpulseMagnitude; |
| | 49731 | 32 | | MotorImpulseMagnitude = motorImpulseMagnitude; |
| | 49731 | 33 | | MotorErrorMagnitude = motorErrorMagnitude; |
| | 49731 | 34 | | ClampedRowCount = clampedRowCount; |
| | 49731 | 35 | | } |
| | | 36 | | |
| | | 37 | | /// <summary> |
| | | 38 | | /// Gets the number of solver rows prepared for the joint. |
| | | 39 | | /// </summary> |
| | | 40 | | public int PreparedRowCount { get; } |
| | | 41 | | |
| | | 42 | | /// <summary> |
| | | 43 | | /// Gets the world-space distance between the joint anchors before the pass. |
| | | 44 | | /// </summary> |
| | | 45 | | public Fixed64 LinearAnchorErrorMagnitude { get; } |
| | | 46 | | |
| | | 47 | | /// <summary> |
| | | 48 | | /// Gets the total angular limit violation magnitude emitted by limit rows. |
| | | 49 | | /// </summary> |
| | | 50 | | public Fixed64 AngularLimitErrorMagnitude { get; } |
| | | 51 | | |
| | | 52 | | /// <summary> |
| | | 53 | | /// Gets the total absolute cached impulse magnitude after the pass. |
| | | 54 | | /// </summary> |
| | | 55 | | public Fixed64 AccumulatedImpulseMagnitude { get; } |
| | | 56 | | |
| | | 57 | | /// <summary> |
| | | 58 | | /// Gets the total absolute incremental impulse emitted during the pass. |
| | | 59 | | /// </summary> |
| | | 60 | | public Fixed64 IncrementalImpulseMagnitude { get; } |
| | | 61 | | |
| | | 62 | | /// <summary> |
| | | 63 | | /// Gets the absolute incremental impulse emitted by motor rows. |
| | | 64 | | /// </summary> |
| | | 65 | | public Fixed64 MotorImpulseMagnitude { get; } |
| | | 66 | | |
| | | 67 | | /// <summary> |
| | | 68 | | /// Gets the angular motor target error magnitude before the pass. |
| | | 69 | | /// </summary> |
| | | 70 | | public Fixed64 MotorErrorMagnitude { get; } |
| | | 71 | | |
| | | 72 | | /// <summary> |
| | | 73 | | /// Gets the number of rows whose accumulated impulse hit a row bound. |
| | | 74 | | /// </summary> |
| | | 75 | | public int ClampedRowCount { get; } |
| | | 76 | | } |