Trailers

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 Settingsfor trailers to disable unnecessary components. ExampleTrailerStateSettingsis included. - Powered Trailers: Enable
Powertrainin trailer's state settings and usesynchronizeGearShiftson 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
disconnectModeon 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).
- Create the dolly as a normal VehicleController.
- Add both
TrailerModule(front attachment) andTrailerHitchModule(rear attachment). - Set
detachable = falseon the dolly's TrailerHitchModule. - Configure attachment points at both ends.
- Optionally use
TrailerStateSettingsto 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();