NWH Vehicle Physics 2
Search Results for

    Show / Hide Table of Contents

    Class MetricsModule

    Vehicle telemetry and statistics tracking module.

    Inheritance
    object
    VehicleComponent
    MetricsModule
    Inherited Members
    VehicleComponent.state
    VehicleComponent.vehicleController
    VehicleComponent.IsActive
    VehicleComponent.VC_Initialize(VehicleController)
    VehicleComponent.VC_Initialize()
    VehicleComponent.VC_FixedUpdate(float)
    VehicleComponent.VC_SetDefaults()
    VehicleComponent.VC_LoadStateFromStateSettings()
    VehicleComponent.VC_Enable(bool)
    VehicleComponent.VC_Disable(bool)
    VehicleComponent.VC_DrawGizmos()
    VehicleComponent.VC_Validate(VehicleController)
    VehicleComponent.UpdateLOD()
    VehicleComponent.ToggleState()
    Namespace: NWH.VehiclePhysics2.Modules.Metrics
    Assembly: NWH.VehiclePhysics2.dll
    Syntax
    [Serializable]
    public class MetricsModule : VehicleComponent
    Remarks

    Tracks odometer, top and average speed, and drift time/distance. Drift detection keys off lateral wheel slip with a 0.75 s grace window so brief grip does not break a chain. Metrics accumulate while the module updates and are never cleared automatically. Disabling and re-enabling, including LOD and state changes, preserves the values; call Reset() on a metric to start a new session.

    Fields

    averageSpeed

    Average speed over the time this module has been updating (m/s).

    Declaration
    public MetricsModule.Metric averageSpeed
    Field Value
    Type Description
    MetricsModule.Metric
    Remarks

    Odometer divided by the time this module has been updating.

    continousDriftDistance

    Distance covered during the current continuous drift (meters).

    Declaration
    public MetricsModule.Metric continousDriftDistance
    Field Value
    Type Description
    MetricsModule.Metric
    Remarks

    Accumulates while any wheel slips laterally and zeroes once the grace window expires. Name is misspelled ("continous"); renaming it would break serialization.

    continousDriftTime

    Duration of the current continuous drift (seconds).

    Declaration
    public MetricsModule.Metric continousDriftTime
    Field Value
    Type Description
    MetricsModule.Metric
    Remarks

    Accumulates while any wheel slips laterally. A 0.75 s grace window covers brief grip without breaking the chain. Name is misspelled ("continous"); renaming it would break serialization.

    odometer

    Total distance traveled by the vehicle (meters).

    Declaration
    public MetricsModule.Metric odometer
    Field Value
    Type Description
    MetricsModule.Metric
    Remarks

    Increments while the vehicle moves and persists until Reset() is called.

    topSpeed

    Highest speed recorded so far (m/s).

    Declaration
    public MetricsModule.Metric topSpeed
    Field Value
    Type Description
    MetricsModule.Metric
    Remarks

    Only written when the current speed exceeds the stored value.

    totalDriftDistance

    Total accumulated drift distance across all drifts (meters).

    Declaration
    public MetricsModule.Metric totalDriftDistance
    Field Value
    Type Description
    MetricsModule.Metric
    Remarks

    Unlike continousDriftDistance this never resets during gameplay.

    totalDriftTime

    Total accumulated drift time across all drifts (seconds).

    Declaration
    public MetricsModule.Metric totalDriftTime
    Field Value
    Type Description
    MetricsModule.Metric
    Remarks

    Unlike continousDriftTime this never resets during gameplay.

    Methods

    VC_Update(float)

    Updates all tracked metrics based on current vehicle state.

    Declaration
    public override void VC_Update(float DeltaTime)
    Parameters
    Type Name Description
    float DeltaTime

    Time since last update in seconds.

    Overrides
    VehicleComponent.VC_Update(float)

    See Also

    ModuleManager
    VehicleController
    WheelComponent
    In this article
    Back to top Copyright © NWH - Vehicle Physics, Aerodynamics, Dynamic Water Physics