| | | 1 | | //======================================================================= |
| | | 2 | | // ContactNormalImpulseResultMixed.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 3D/2D contact-normal impulse result. |
| | | 14 | | /// </summary> |
| | | 15 | | internal readonly struct ContactNormalImpulseResultMixed |
| | | 16 | | { |
| | | 17 | | public ContactNormalImpulseResultMixed( |
| | | 18 | | Fixed64 normalVelocity, |
| | | 19 | | Fixed64 impulseScalar, |
| | | 20 | | Vector3d linearVelocityDelta3D, |
| | | 21 | | Vector3d angularVelocityDelta3D, |
| | | 22 | | Vector2d linearVelocityDelta2D, |
| | | 23 | | Fixed64 angularVelocityDelta2D) |
| | 181420 | 24 | | : this( |
| | 181420 | 25 | | normalVelocity, |
| | 181420 | 26 | | impulseScalar, |
| | 181420 | 27 | | impulseScalar, |
| | 181420 | 28 | | linearVelocityDelta3D, |
| | 181420 | 29 | | angularVelocityDelta3D, |
| | 181420 | 30 | | linearVelocityDelta2D, |
| | 181420 | 31 | | angularVelocityDelta2D) |
| | | 32 | | { |
| | 181420 | 33 | | } |
| | | 34 | | |
| | | 35 | | public ContactNormalImpulseResultMixed( |
| | | 36 | | Fixed64 normalVelocity, |
| | | 37 | | Fixed64 impulseScalar, |
| | | 38 | | Fixed64 appliedImpulseScalar, |
| | | 39 | | Vector3d linearVelocityDelta3D, |
| | | 40 | | Vector3d angularVelocityDelta3D, |
| | | 41 | | Vector2d linearVelocityDelta2D, |
| | | 42 | | Fixed64 angularVelocityDelta2D, |
| | | 43 | | bool hasRepresentableNormalVelocity = true, |
| | | 44 | | bool hasRepresentableAppliedImpulse = true) |
| | | 45 | | { |
| | 184652 | 46 | | NormalVelocity = normalVelocity; |
| | 184652 | 47 | | ImpulseScalar = impulseScalar; |
| | 184652 | 48 | | AppliedImpulseScalar = appliedImpulseScalar; |
| | 184652 | 49 | | LinearVelocityDelta3D = linearVelocityDelta3D; |
| | 184652 | 50 | | AngularVelocityDelta3D = angularVelocityDelta3D; |
| | 184652 | 51 | | LinearVelocityDelta2D = linearVelocityDelta2D; |
| | 184652 | 52 | | AngularVelocityDelta2D = angularVelocityDelta2D; |
| | 184652 | 53 | | HasRepresentableNormalVelocity = hasRepresentableNormalVelocity; |
| | 184652 | 54 | | HasRepresentableAppliedImpulse = hasRepresentableAppliedImpulse; |
| | 184652 | 55 | | } |
| | | 56 | | |
| | | 57 | | public Fixed64 NormalVelocity { get; } |
| | | 58 | | |
| | | 59 | | public Fixed64 ImpulseScalar { get; } |
| | | 60 | | |
| | | 61 | | public Fixed64 AppliedImpulseScalar { get; } |
| | | 62 | | |
| | | 63 | | public bool HasRepresentableNormalVelocity { get; } |
| | | 64 | | |
| | | 65 | | public bool HasRepresentableAppliedImpulse { get; } |
| | | 66 | | |
| | | 67 | | public Vector3d LinearVelocityDelta3D { get; } |
| | | 68 | | |
| | | 69 | | public Vector3d AngularVelocityDelta3D { get; } |
| | | 70 | | |
| | | 71 | | public Vector2d LinearVelocityDelta2D { get; } |
| | | 72 | | |
| | | 73 | | public Fixed64 AngularVelocityDelta2D { get; } |
| | | 74 | | } |