| | | 1 | | //======================================================================= |
| | | 2 | | // ContinuousCollisionTargetPolicy.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 | | namespace Gravitas.CollisionHandling; |
| | | 9 | | |
| | | 10 | | /// <summary> |
| | | 11 | | /// Defines eligibility for dynamic candidate indexes and static or kinematic CCD targets. |
| | | 12 | | /// </summary> |
| | | 13 | | internal static class ContinuousCollisionTargetPolicy |
| | | 14 | | { |
| | | 15 | | internal static bool AllowsIndexed3DTarget( |
| | | 16 | | bool isSelf, |
| | | 17 | | bool active, |
| | | 18 | | bool dynamicBody, |
| | | 19 | | bool kinematic, |
| | | 20 | | bool movingKinematic, |
| | | 21 | | bool trigger, |
| | | 22 | | bool physicalPairRequired) => |
| | 7841 | 23 | | !isSelf |
| | 7841 | 24 | | && active |
| | 7841 | 25 | | && (kinematic ? movingKinematic : dynamicBody) |
| | 7841 | 26 | | && !trigger |
| | 7841 | 27 | | && physicalPairRequired; |
| | | 28 | | |
| | | 29 | | internal static bool AllowsIndexed2DTarget( |
| | | 30 | | bool isSelf, |
| | | 31 | | bool active, |
| | | 32 | | bool dynamicBody, |
| | | 33 | | bool kinematic, |
| | | 34 | | bool movingKinematic, |
| | | 35 | | bool trigger, |
| | | 36 | | bool physicalPairRequired) => |
| | 1138 | 37 | | !isSelf |
| | 1138 | 38 | | && active |
| | 1138 | 39 | | && (kinematic ? movingKinematic : dynamicBody) |
| | 1138 | 40 | | && !trigger |
| | 1138 | 41 | | && physicalPairRequired; |
| | | 42 | | |
| | | 43 | | internal static bool AllowsMixedIndexedTarget( |
| | | 44 | | bool active, |
| | | 45 | | bool dynamicBody, |
| | | 46 | | bool kinematic, |
| | | 47 | | bool movingKinematic, |
| | | 48 | | bool trigger, |
| | | 49 | | bool mixedPairRequired) => |
| | 157 | 50 | | active |
| | 157 | 51 | | && (kinematic ? movingKinematic : dynamicBody) |
| | 157 | 52 | | && !trigger |
| | 157 | 53 | | && mixedPairRequired; |
| | | 54 | | |
| | | 55 | | internal static bool AllowsStaticOrKinematic3DTarget( |
| | | 56 | | bool isSelf, |
| | | 57 | | bool ignored, |
| | | 58 | | bool trigger, |
| | | 59 | | bool physicalPairRequired, |
| | | 60 | | bool isStatic, |
| | | 61 | | bool bodyKinematic) => |
| | 7024 | 62 | | !isSelf |
| | 7024 | 63 | | && !ignored |
| | 7024 | 64 | | && !trigger |
| | 7024 | 65 | | && physicalPairRequired |
| | 7024 | 66 | | && (isStatic || bodyKinematic); |
| | | 67 | | |
| | | 68 | | internal static bool AllowsStaticOrKinematic2DTarget( |
| | | 69 | | bool isSelf, |
| | | 70 | | bool ignored, |
| | | 71 | | bool trigger, |
| | | 72 | | bool physicalPairRequired, |
| | | 73 | | bool isStatic, |
| | | 74 | | bool bodyKinematic) => |
| | 562 | 75 | | !isSelf |
| | 562 | 76 | | && !ignored |
| | 562 | 77 | | && !trigger |
| | 562 | 78 | | && physicalPairRequired |
| | 562 | 79 | | && (isStatic || bodyKinematic); |
| | | 80 | | |
| | | 81 | | internal static bool AllowsMixedStaticOrKinematicTarget( |
| | | 82 | | bool ignored, |
| | | 83 | | bool trigger, |
| | | 84 | | bool mixedPairRequired, |
| | | 85 | | bool isStatic, |
| | | 86 | | bool bodyKinematic) => |
| | 375 | 87 | | !ignored |
| | 375 | 88 | | && !trigger |
| | 375 | 89 | | && mixedPairRequired |
| | 375 | 90 | | && (isStatic || bodyKinematic); |
| | | 91 | | } |