NWH Vehicle Physics 2
Search Results for

    Show / Hide Table of Contents

    Class TCSModule

    Traction Control System (TCS) module for NWH Vehicle Physics 2.

    Inheritance
    object
    VehicleComponent
    TCSModule
    Inherited Members
    VehicleComponent.state
    VehicleComponent.vehicleController
    VehicleComponent.IsActive
    VehicleComponent.VC_Initialize(VehicleController)
    VehicleComponent.VC_Initialize()
    VehicleComponent.VC_SetDefaults()
    VehicleComponent.VC_LoadStateFromStateSettings()
    VehicleComponent.VC_Update(float)
    VehicleComponent.VC_DrawGizmos()
    VehicleComponent.VC_Validate(VehicleController)
    VehicleComponent.UpdateLOD()
    VehicleComponent.ToggleState()
    Namespace: NWH.VehiclePhysics2.Modules.TCS
    Assembly: NWH.VehiclePhysics2.dll
    Syntax
    [Serializable]
    public class TCSModule : VehicleComponent
    Remarks

    TCS prevents wheel spin during acceleration by reducing engine power when longitudinal slip exceeds a threshold. This improves traction, vehicle stability, and tire wear, especially on slippery surfaces or during aggressive acceleration.

    The system monitors driven wheels for excessive slip and cuts engine power almost completely when triggered. Unlike real-world systems that modulate power gradually, this implementation uses an aggressive cut for simplicity and effectiveness.

    Key behaviors: - Only monitors powered wheels (FWD, RWD, or AWD configurations supported) - Ignores slip during gear changes to prevent false triggers - Allows controlled wheel spin up to the threshold for optimal acceleration - Works independently of ABS and ESC modules

    For optimal performance, set the slip threshold based on your tire characteristics. Sport/racing applications may use higher thresholds (0.15-0.25) for more aggressive launches. Comfort/safety focused applications should use lower thresholds (0.05-0.12).

    Fields

    active

    Indicates whether TCS is currently limiting engine power.

    Declaration
    [Tooltip("Is TCS currently active?")]
    public bool active
    Field Value
    Type Description
    bool
    Remarks

    Read-only at runtime. True when TCS is actively cutting engine power due to wheel slip. Use this for UI indicators, telemetry, or to coordinate with other vehicle systems.

    lowSpeedSlipThreshold

    Slip threshold at low speeds (more permissive than slipThreshold).

    Declaration
    [Range(0, 1)]
    [Tooltip("Slip threshold at low speeds (more permissive). Interpolates to slipThreshold as speed increases.")]
    public float lowSpeedSlipThreshold
    Field Value
    Type Description
    float
    Remarks

    At low speeds, differential behavior during turns causes normal wheel speed differences that TCS may interpret as slip. A higher threshold at low speeds prevents TCS from cutting power during slow maneuvers. The effective threshold interpolates from this value to slipThreshold as speed increases from lowerSpeedThreshold to upperSpeedThreshold.

    lowerSpeedThreshold

    Minimum vehicle speed (m/s) required for TCS to engage.

    Declaration
    [Tooltip("Speed under which TCS will not work.")]
    public float lowerSpeedThreshold
    Field Value
    Type Description
    float
    Remarks

    Below this speed, TCS is disabled to allow for initial vehicle movement and low-speed maneuvering. This prevents TCS from interfering with starting from a standstill on slopes or rough terrain.

    Lower values (0.5-1.5 m/s): More aggressive TCS coverage, may interfere with hill starts. Higher values (2-4 m/s): Allows more wheel spin at low speeds, easier launches on difficult terrain. Default: 2.0 m/s

    onTCSActive

    Unity event triggered each physics frame while TCS is actively limiting power.

    Declaration
    [Tooltip("Called each frame while TCS is active.")]
    public UnityEvent onTCSActive
    Field Value
    Type Description
    UnityEvent
    Remarks

    Use this event to trigger visual or audio feedback like dashboard warning lights or engine sound changes. The event fires continuously while TCS is engaged, not just on initial activation.

    slipThreshold

    Longitudinal slip threshold at which TCS will cut engine power.

    Declaration
    [Range(0, 1)]
    [Tooltip("Longitudinal slip threshold at which TCS will activate.")]
    public float slipThreshold
    Field Value
    Type Description
    float
    Remarks

    This value should be set based on your tire's optimal slip range for acceleration. Most tires achieve peak longitudinal force at 5-15% slip during acceleration.

    Lower values (0.05-0.08): Conservative TCS, maintains optimal traction but may feel restrictive. Medium values (0.10-0.15): Balanced setting for most applications. Higher values (0.15-0.30): Allows more wheel spin, sportier feel but less traction on slippery surfaces.

    Note: This value should typically be lower than the ABS slip threshold since acceleration slip peaks at lower values than braking slip.

    upperSpeedThreshold

    Speed (m/s) at which TCS transitions to full intensity.

    Declaration
    [Tooltip("Speed at which TCS transitions to full intensity.")]
    public float upperSpeedThreshold
    Field Value
    Type Description
    float
    Remarks

    Between lowerSpeedThreshold and upperSpeedThreshold, the slip threshold interpolates from lowSpeedSlipThreshold to slipThreshold. Above this speed, TCS uses the normal slipThreshold value for full intensity traction control.

    Methods

    VC_Disable(bool)

    Disables the component and stops updates. Override to add component-specific disable logic.

    Declaration
    public override bool VC_Disable(bool calledByParent)
    Parameters
    Type Name Description
    bool calledByParent

    True if called by parent component or LOD system

    Returns
    Type Description
    bool

    True if successfully disabled, false otherwise

    Overrides
    VehicleComponent.VC_Disable(bool)
    Remarks

    Component must be initialized before it can be disabled. Tracks whether disable was called by parent to manage LOD system interaction.

    VC_Enable(bool)

    Enables the component and starts updates. Override to add component-specific enable logic.

    Declaration
    public override bool VC_Enable(bool calledByParent)
    Parameters
    Type Name Description
    bool calledByParent

    True if called by parent component or LOD system

    Returns
    Type Description
    bool

    True if successfully enabled, false otherwise

    Overrides
    VehicleComponent.VC_Enable(bool)
    Remarks

    Will initialize the component if not already initialized. Components disabled by LOD system will track the parent caller to prevent manual enabling while LOD is controlling state.

    VC_FixedUpdate(float)

    Pushes TCS enable/threshold to each driven wheel; actual slip cut runs at the friction level via counter-torque.

    Declaration
    public override void VC_FixedUpdate(float DeltaTime)
    Parameters
    Type Name Description
    float DeltaTime
    Overrides
    VehicleComponent.VC_FixedUpdate(float)

    See Also

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