Class MetricsModule
Vehicle telemetry and statistics tracking module.
Inherited Members
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. |