| | | 1 | | //======================================================================= |
| | | 2 | | // ContactNormalImpulseResult3D.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 3D contact-normal impulse result for two participants. |
| | | 14 | | /// </summary> |
| | | 15 | | internal readonly struct ContactNormalImpulseResult3D |
| | | 16 | | { |
| | | 17 | | public ContactNormalImpulseResult3D( |
| | | 18 | | Fixed64 normalVelocity, |
| | | 19 | | Fixed64 impulseScalar, |
| | | 20 | | Vector3d linearVelocityDeltaA, |
| | | 21 | | Vector3d angularVelocityDeltaA, |
| | | 22 | | Vector3d linearVelocityDeltaB, |
| | | 23 | | Vector3d angularVelocityDeltaB) |
| | 590891 | 24 | | : this( |
| | 590891 | 25 | | normalVelocity, |
| | 590891 | 26 | | impulseScalar, |
| | 590891 | 27 | | impulseScalar, |
| | 590891 | 28 | | linearVelocityDeltaA, |
| | 590891 | 29 | | angularVelocityDeltaA, |
| | 590891 | 30 | | linearVelocityDeltaB, |
| | 590891 | 31 | | angularVelocityDeltaB) |
| | | 32 | | { |
| | 590891 | 33 | | } |
| | | 34 | | |
| | | 35 | | public ContactNormalImpulseResult3D( |
| | | 36 | | Fixed64 normalVelocity, |
| | | 37 | | Fixed64 impulseScalar, |
| | | 38 | | Fixed64 appliedImpulseScalar, |
| | | 39 | | Vector3d linearVelocityDeltaA, |
| | | 40 | | Vector3d angularVelocityDeltaA, |
| | | 41 | | Vector3d linearVelocityDeltaB, |
| | | 42 | | Vector3d angularVelocityDeltaB, |
| | | 43 | | bool hasRepresentableNormalVelocity = true, |
| | | 44 | | bool hasRepresentableAppliedImpulse = true) |
| | | 45 | | { |
| | 602194 | 46 | | NormalVelocity = normalVelocity; |
| | 602194 | 47 | | ImpulseScalar = impulseScalar; |
| | 602194 | 48 | | AppliedImpulseScalar = appliedImpulseScalar; |
| | 602194 | 49 | | LinearVelocityDeltaA = linearVelocityDeltaA; |
| | 602194 | 50 | | AngularVelocityDeltaA = angularVelocityDeltaA; |
| | 602194 | 51 | | LinearVelocityDeltaB = linearVelocityDeltaB; |
| | 602194 | 52 | | AngularVelocityDeltaB = angularVelocityDeltaB; |
| | 602194 | 53 | | HasRepresentableNormalVelocity = hasRepresentableNormalVelocity; |
| | 602194 | 54 | | HasRepresentableAppliedImpulse = hasRepresentableAppliedImpulse; |
| | 602194 | 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 LinearVelocityDeltaA { get; } |
| | | 68 | | |
| | | 69 | | public Vector3d AngularVelocityDeltaA { get; } |
| | | 70 | | |
| | | 71 | | public Vector3d LinearVelocityDeltaB { get; } |
| | | 72 | | |
| | | 73 | | public Vector3d AngularVelocityDeltaB { get; } |
| | | 74 | | } |