< Summary

Information
Class: Gravitas.BodyMotionTypeSupport
Assembly: Gravitas
File(s): /home/runner/work/Gravitas/Gravitas/src/Gravitas/Core/BodyMotionType.cs
Line coverage
100%
Covered lines: 7
Uncovered lines: 0
Coverable lines: 7
Total lines: 49
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
IsValid(...)100%11100%
ThrowIfInvalid(...)100%11100%

File(s)

/home/runner/work/Gravitas/Gravitas/src/Gravitas/Core/BodyMotionType.cs

#LineLine coverage
 1//=======================================================================
 2// BodyMotionType.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
 8using SwiftCollections;
 9using System.Runtime.CompilerServices;
 10
 11namespace Gravitas;
 12
 13/// <summary>
 14/// Selects whether a body is solver controlled, host controlled, or immobile.
 15/// </summary>
 16public enum BodyMotionType : byte
 17{
 18    /// <summary>
 19    /// The solver controls the body subject to its frozen degrees of freedom.
 20    /// </summary>
 21    Dynamic = 0,
 22
 23    /// <summary>
 24    /// The host controls the body while the solver treats it as infinite mass.
 25    /// </summary>
 26    Kinematic = 1,
 27
 28    /// <summary>
 29    /// The body is excluded from per-frame motion and treated as infinite mass.
 30    /// </summary>
 31    Static = 2
 32}
 33
 34internal static class BodyMotionTypeSupport
 35{
 36    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 37    internal static bool IsValid(this BodyMotionType motionType) =>
 1025738        (byte)motionType <= (byte)BodyMotionType.Static;
 39
 40    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 41    internal static void ThrowIfInvalid(this BodyMotionType motionType, string parameterName)
 42    {
 1025743        SwiftThrowHelper.ThrowIfArgumentOutOfRange(
 1025744            !motionType.IsValid(),
 1025745            (int)motionType,
 1025746            parameterName,
 1025747            "Body motion type must be Dynamic, Kinematic, or Static.");
 1025348    }
 49}