NWH Vehicle Physics 2
Search Results for

    Show / Hide Table of Contents

    Trailers

    Demo truck and trailer in NWH Vehicle Physics 2

    Both truck and trailer in NVP2 use the same VehicleController script. Therefore, they should both be configured as a normal vehicle. Check Quick Start Guide for more info on vehicle setup.

    • Towing vehicle needs to have TrailerHitchModule attached.
    • Trailer vehicle needs to have TrailerModule attached.

    Click on the names of individual modules for more info.

    Configuration Tips

    • State Settings: Use separate State Settings for trailers to disable unnecessary components. Example TrailerStateSettings is included.
    • Powered Trailers: Enable Powertrain in trailer's state settings and use synchronizeGearShifts on TrailerModule for drive-on-trailers.
    • Effects: Input and lighting synchronization enables blinkers, brake lights, and other effects on trailers automatically.
    • Static Friction: When the towing vehicle's wheels break static friction, it propagates to the trailer automatically for synchronized movement from rest.

    Attachment

    Drive the vehicle so that the attachment points are close and press the TrailerAttachDetach key (T by default). Attachment uses SphereCollider triggers whose radius can be configured through the module inspectors.

    Multi-Trailer Configurations

    NVP2 supports multi-trailer configurations (road trains) with the following features:

    Connect/Disconnect Behavior

    • Connecting: Always attaches the nearest trailer in range when multiple trailers are detected.
    • Disconnecting: Configurable via disconnectMode on TrailerHitchModule:
      • Closest: Detaches the trailer directly attached to this vehicle.
      • Furthest: Detaches the last non-dolly trailer in the chain.

    Converter Dolly Setup

    A converter dolly connects trailers in a road train (Truck → Dolly → Trailer).

    1. Create the dolly as a normal VehicleController.
    2. Add both TrailerModule (front attachment) and TrailerHitchModule (rear attachment).
    3. Set detachable = false on the dolly's TrailerHitchModule.
    4. Configure attachment points at both ends.
    5. Optionally use TrailerStateSettings to disable the powertrain.

    When a trailer's hitch has detachable = false:

    • It's recognized as a connector and skipped in GetTrailerCount().
    • It's skipped when using disconnectMode = Furthest.
    • Chain walking still includes it if includeDollies = true.

    Chain Walking API

    // Get all trailers including connectors
    List<TrailerModule> allChain = hitchModule.GetTrailerChain(includeDollies: true);
    
    // Get only actual trailers (exclude connectors with non-detachable hitches)
    List<TrailerModule> trailersOnly = hitchModule.GetTrailerChain(includeDollies: false);
    
    // Get last non-connector trailer
    TrailerModule last = hitchModule.GetLastTrailerInChain();
    
    // Count actual trailers (excludes dollies)
    int count = hitchModule.GetTrailerCount();
    

    Modules

    • TrailerHitchModule
    • TrailerModule
    In this article
    Back to top Copyright © NWH - Vehicle Physics, Aerodynamics, Dynamic Water Physics