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.

Click on the names of individual modules for more info.

Tips

Attaching Trailer

Modules

Trailer Hitch Module

TrailerHitch module.

VehicleController with TrailerHitchModule can attach a VehicleController with TrailerModule as a trailer.

  • Both TrailerHitchModule and TrailerModule can be present on one vehicle at the same time.
  • AttachmentPoint is the point at which the trailer will be attached. The trailer will be moved so that both trailer and hitch AttachmentPoints are at the same position. This is where the physics joint gets created. Attachment Point needs to be a child of the GameObject containing the TrailerHitchModule.
  • On initialization a SphereCollider trigger is created at the attachment point. This is used to detect if a TrailerModule is nearby. When there is overlap between the TrailerModule and TrailerHitchModule triggers, pressing 'T' (default key mapping) will connect the trailer.

Also check Trailer module.

2023/05/14 16:35

Trailer Module

TrailerModule inspector.

TrailerModule works in tandem with TrailerHitchModule. VehicleController that has TrailerModule is able attach to a VehicleController that has TrailerHitchModule.

  • One vehicle can have both TrailerHitchModule and TrailerModule.
  • Attachment Point is the point at which the trailer will be attached to the towing vehicle. The script creates a SphereCollider trigger at this point which detects if the TrailerHitchModule Attachment Point is nearby. Attachment Point needs to be a child of the GameObject containing the TrailerModule.
  • Trailer Stand is the object which will be enabled if the trailer is detached and vice versa. It prevents the trailer from tipping forward on trailers with only the back axle.
  • If Synchronize Gear Shifts is enabled the trailer object will be kept in the same gear. This allows for powered trailer or vehicles that are constructed out of two Rigidbodies.

Also check Trailer Hitch module.

2023/05/14 16:35