< Summary

Information
Class: Gravitas.Queries.Physics2DSupportHit
Assembly: Gravitas
File(s): /home/runner/work/Gravitas/Gravitas/src/Gravitas/Queries/2D/Support/Physics2DSupportHit.cs
Line coverage
100%
Covered lines: 9
Uncovered lines: 0
Coverable lines: 9
Total lines: 34
Line coverage: 100%
Branch coverage
100%
Covered branches: 10
Total branches: 10
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
get_IsCurrentLifetime()100%1010100%

File(s)

/home/runner/work/Gravitas/Gravitas/src/Gravitas/Queries/2D/Support/Physics2DSupportHit.cs

#LineLine coverage
 1//=======================================================================
 2// Physics2DSupportHit.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
 8namespace Gravitas.Queries;
 9
 10/// <summary>A sampled support surface and its owning collider registration lifetime.</summary>
 11public readonly struct Physics2DSupportHit
 12{
 13    private readonly long _lifetime;
 14
 15    internal Physics2DSupportHit(Physics2DHit hit, long frame)
 16    {
 23917        Hit = hit;
 23918        SampledFrame = frame;
 23919        _lifetime = hit.Collider.LifetimeVersion;
 23920    }
 21
 22    /// <summary>Gets the selected target-surface witness, not the probe center.</summary>
 23    public Physics2DHit Hit { get; }
 24    /// <summary>Gets the context frame on which the query ran.</summary>
 25    public long SampledFrame { get; }
 26    /// <summary>Whether the same active collider registration still exists; this does not certify geometric freshness.<
 2127    public bool IsCurrentLifetime => Hit.Collider != null
 2128        && Hit.Collider.IsActive && Hit.Collider.LifetimeVersion == _lifetime
 2129        && !Hit.Collider.Context.IsDisposed
 2130        && Hit.Collider.Context.Physics2D.TryGetColliderById(Hit.Collider.Id, out var registered)
 2131        && ReferenceEquals(registered, Hit.Collider);
 32}
 33// MIT License, Copyright (c) 2026-present David Oravsky (mrdav30)
 34// See LICENSE file in the project root for full license information.