< Summary

Information
Class: Trailblazer.Navigation.Motor.GroundCondition
Assembly: Trailblazer
File(s): /home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Navigation/Motor/Surface/GroundCondition.cs
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 56
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_GroundNormal()100%22100%
Clone()100%11100%
RecordData(...)100%11100%

File(s)

/home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Navigation/Motor/Surface/GroundCondition.cs

#LineLine coverage
 1using Chronicler;
 2using FixedMathSharp;
 3using System;
 4
 5namespace Trailblazer.Navigation.Motor;
 6
 7/// <summary>
 8/// Represents the state of the surface the scout is interacting with, including surface movement and normal data.
 9/// </summary>
 10[Serializable]
 11public struct GroundCondition : IRecordable
 12{
 13    /// <summary>
 14    /// The host-provided sampled platform state the scout is currently standing on.
 15    /// </summary>
 16    public PlatformSnapshot Platform;
 17
 18    /// <summary>
 19    /// The current surface friction applied to movement.
 20    /// </summary>
 21    public Fixed64 SurfaceFriction;
 22
 23    /// <summary>
 24    /// Determines how the scout inherits movement from the ground surface when the sampled platform is not inert.
 25    /// </summary>
 26    public MotionTransfer MotionTransferState;
 27
 28    /// <summary>
 29    /// Convenience normal derived from the sampled platform transform.
 30    /// </summary>
 64831    public readonly Vector3d GroundNormal => Platform.Active ? Platform.Transform.Up : Vector3d.Zero;
 32
 33    /// <summary>
 34    /// Creates a new GroundCondition instance that is a copy of the current instance.
 35    /// </summary>
 36    /// <remarks>
 37    /// The returned object is a shallow copy. Reference-type properties are not deeply cloned.
 38    /// </remarks>
 39    /// <returns>
 40    /// A new GroundCondition object with the same Platform, SurfaceFriction, and MotionTransferState values as the curr
 41    /// </returns>
 12742    public GroundCondition Clone() => new()
 12743    {
 12744        Platform = Platform,
 12745        SurfaceFriction = SurfaceFriction,
 12746        MotionTransferState = MotionTransferState
 12747    };
 48
 49    /// <inheritdoc/>
 50    public void RecordData(IChronicler chronicler)
 51    {
 7052        chronicler.LookDeepStruct(ref Platform, "Platform");
 7053        chronicler.LookValue(ref SurfaceFriction, "SurfaceFriction", Fixed64.Zero);
 7054        chronicler.LookValue(ref MotionTransferState, "MotionTransferState", MotionTransfer.None);
 7055    }
 56}