< Summary

Information
Class: Trailblazer.Navigation.Motor.GlobalEnvironmentForces
Assembly: Trailblazer
File(s): /home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Navigation/Motor/Locomotion/Forces/GlobalEnvironmentForces.cs
Line coverage
100%
Covered lines: 9
Uncovered lines: 0
Coverable lines: 9
Total lines: 63
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
.cctor()100%11100%
.ctor()100%11100%
Reset()100%11100%

File(s)

/home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Navigation/Motor/Locomotion/Forces/GlobalEnvironmentForces.cs

#LineLine coverage
 1//=======================================================================
 2// GlobalEnvironmentForces.cs
 3//=======================================================================
 4// MIT License, Copyright (c) 2024-present David Oravsky (mrdav30)
 5// See LICENSE file in the project root for full license information.
 6//=======================================================================
 7
 8using FixedMathSharp;
 9
 10namespace Trailblazer.Navigation.Motor;
 11
 12/// <summary>
 13/// Holds simulation-wide gravity defaults read by all <see cref="MoveLocomotion"/> instances
 14/// that do not carry a per-instance override.
 15/// </summary>
 16/// <remarks>
 17/// Access the shared instance through <see cref="LocomotionForces.GlobalForces"/>.
 18/// Assigning fields on that instance changes the effective gravity for every unoverridden object
 19/// on the next simulation frame without touching individual locomotion instances.
 20/// </remarks>
 21public sealed class GlobalEnvironmentForces
 22{
 23    /// <summary>
 24    /// The default fixed-point acceleration force for gravity.
 25    /// </summary>
 26    /// <remarks>
 27    /// Default acceleration due to gravity is approximately 9.8 m/s².
 28    /// </remarks>
 129    public readonly static Fixed64 DefaultGravityForce = Fixed64.FromRaw(0x9CCCCCCCDL);
 30
 31    /// <summary>
 32    /// The default maximum downward fixed-point velocity a scout can reach due to gravity.
 33    /// </summary>
 34    /// <remarks>
 35    /// Default terminal velocity is roughly 53 m/s (190 km/h or ~120 mph).
 36    /// </remarks>
 137    public readonly static Fixed64 DefaultTerminalVelocity = (Fixed64)53f;
 38
 39    /// <summary>
 40    /// The gravity force applied to all navigators without a per-instance override.
 41    /// </summary>
 42    public Fixed64 GravityForce;
 43
 44    /// <summary>
 45    /// The terminal fall velocity cap applied to all navigators without a per-instance override.
 46    /// </summary>
 47    public Fixed64 TerminalVelocity;
 48
 149    internal GlobalEnvironmentForces()
 50    {
 151        GravityForce = DefaultGravityForce;
 152        TerminalVelocity = DefaultTerminalVelocity;
 153    }
 54
 55    /// <summary>
 56    /// Restores both global forces to the <see cref="MoveLocomotion"/> defaults.
 57    /// </summary>
 58    public void Reset()
 59    {
 560        GravityForce = DefaultGravityForce;
 561        TerminalVelocity = DefaultTerminalVelocity;
 562    }
 63}

Methods/Properties

.cctor()
.ctor()
Reset()