| | | 1 | | //======================================================================= |
| | | 2 | | // BodyMotionTypeSupport.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 System.Runtime.CompilerServices; |
| | | 9 | | |
| | | 10 | | namespace Gravitas; |
| | | 11 | | |
| | | 12 | | /// <summary> |
| | | 13 | | /// Validates body mobility values from configuration and motion updates. |
| | | 14 | | /// </summary> |
| | | 15 | | internal static class PhysicsMobilityTypeSupport |
| | | 16 | | { |
| | | 17 | | [MethodImpl(MethodImplOptions.AggressiveInlining)] |
| | | 18 | | internal static bool IsValid(this PhysicsMobilityType motionType) => |
| | 15560 | 19 | | (byte)motionType <= (byte)PhysicsMobilityType.Static; |
| | | 20 | | |
| | | 21 | | [MethodImpl(MethodImplOptions.AggressiveInlining)] |
| | | 22 | | internal static void ThrowIfInvalid(this PhysicsMobilityType motionType, string parameterName) |
| | | 23 | | { |
| | 15560 | 24 | | ChronicleGuard.ThrowIfArgumentOutOfRange( |
| | 15560 | 25 | | !motionType.IsValid(), |
| | 15560 | 26 | | (int)motionType, |
| | 15560 | 27 | | parameterName, |
| | 15560 | 28 | | "Body motion type must be Dynamic, Kinematic, or Static."); |
| | 15556 | 29 | | } |
| | | 30 | | } |