| | | 1 | | //======================================================================= |
| | | 2 | | // ContactNormalVelocityDeltaResultMixed.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.CollisionHandling; |
| | | 11 | | |
| | | 12 | | /// <summary> |
| | | 13 | | /// Side-effect-free mixed velocity deltas for a normal response whose impulse |
| | | 14 | | /// scalar does not need to be representable. |
| | | 15 | | /// </summary> |
| | | 16 | | internal readonly struct ContactNormalVelocityDeltaResultMixed |
| | | 17 | | { |
| | | 18 | | public ContactNormalVelocityDeltaResultMixed( |
| | | 19 | | Fixed64 normalVelocity, |
| | | 20 | | Vector3d linearVelocityDelta3D, |
| | | 21 | | Vector3d angularVelocityDelta3D, |
| | | 22 | | Vector2d linearVelocityDelta2D, |
| | | 23 | | Fixed64 angularVelocityDelta2D) |
| | 20 | 24 | | : this( |
| | 20 | 25 | | normalVelocity, |
| | 20 | 26 | | linearVelocityDelta3D, |
| | 20 | 27 | | angularVelocityDelta3D, |
| | 20 | 28 | | linearVelocityDelta2D, |
| | 20 | 29 | | angularVelocityDelta2D, |
| | 20 | 30 | | normalVelocity < Fixed64.Zero, |
| | 20 | 31 | | hasRepresentableNormalVelocity: true) |
| | | 32 | | { |
| | 20 | 33 | | } |
| | | 34 | | |
| | | 35 | | public ContactNormalVelocityDeltaResultMixed( |
| | | 36 | | Fixed64 normalVelocity, |
| | | 37 | | Vector3d linearVelocityDelta3D, |
| | | 38 | | Vector3d angularVelocityDelta3D, |
| | | 39 | | Vector2d linearVelocityDelta2D, |
| | | 40 | | Fixed64 angularVelocityDelta2D, |
| | | 41 | | bool isClosing, |
| | | 42 | | bool hasRepresentableNormalVelocity) |
| | | 43 | | { |
| | 20 | 44 | | NormalVelocity = normalVelocity; |
| | 20 | 45 | | LinearVelocityDelta3D = linearVelocityDelta3D; |
| | 20 | 46 | | AngularVelocityDelta3D = angularVelocityDelta3D; |
| | 20 | 47 | | LinearVelocityDelta2D = linearVelocityDelta2D; |
| | 20 | 48 | | AngularVelocityDelta2D = angularVelocityDelta2D; |
| | 20 | 49 | | IsClosing = isClosing; |
| | 20 | 50 | | HasRepresentableNormalVelocity = hasRepresentableNormalVelocity; |
| | 20 | 51 | | } |
| | | 52 | | |
| | | 53 | | public Fixed64 NormalVelocity { get; } |
| | | 54 | | |
| | | 55 | | public bool IsClosing { get; } |
| | | 56 | | |
| | | 57 | | public bool HasRepresentableNormalVelocity { get; } |
| | | 58 | | |
| | | 59 | | public Vector3d LinearVelocityDelta3D { get; } |
| | | 60 | | |
| | | 61 | | public Vector3d AngularVelocityDelta3D { get; } |
| | | 62 | | |
| | | 63 | | public Vector2d LinearVelocityDelta2D { get; } |
| | | 64 | | |
| | | 65 | | public Fixed64 AngularVelocityDelta2D { get; } |
| | | 66 | | } |