NWH Vehicle Physics 2
Search Results for

    Show / Hide Table of Contents

    Class TrailerModuleWrapper

    MonoBehaviour wrapper for the TrailerModule.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    ModuleWrapper
    TrailerModuleWrapper
    Namespace: NWH.VehiclePhysics2.Modules.Trailer
    Assembly: NWH.VehiclePhysics2.dll
    Syntax
    [Serializable]
    [DisallowMultipleComponent]
    public class TrailerModuleWrapper : ModuleWrapper
    Remarks

    This wrapper enables the TrailerModule to be added as a Unity component and handles the creation and management of the attachment point trigger collider. The wrapper must be added to a GameObject with a VehicleController.

    The wrapper automatically creates a SphereCollider trigger at the attachment point during Awake(), which is detected by TrailerHitchModule for connection. It also handles joint break events and provides visual feedback through Gizmos.

    Fields

    module

    The wrapped TrailerModule instance.

    Declaration
    public TrailerModule module
    Field Value
    Type Description
    TrailerModule
    Remarks

    Contains all configuration and runtime state for the trailer system. Access this property to modify trailer settings or check attachment status.

    Methods

    GetModule()

    Gets the wrapped module as a VehicleComponent.

    Declaration
    public override VehicleComponent GetModule()
    Returns
    Type Description
    VehicleComponent

    The TrailerModule instance cast to VehicleComponent

    Overrides
    ModuleWrapper.GetModule()
    Remarks

    Used by the module system for generic module handling and lifecycle management.

    OnDrawGizmos()

    Draws visual indicators for the trailer attachment point in the Scene view.

    Declaration
    public void OnDrawGizmos()
    Remarks

    Displays a sphere at the attachment point position and a "Trailer Attachment Point" label to help with positioning and alignment during development.

    SetModule(VehicleComponent)

    Sets the wrapped module from a VehicleComponent reference.

    Declaration
    public override void SetModule(VehicleComponent module)
    Parameters
    Type Name Description
    VehicleComponent module

    The VehicleComponent to wrap, must be a TrailerModule instance

    Overrides
    ModuleWrapper.SetModule(VehicleComponent)
    Remarks

    Used by the module system when dynamically creating or replacing modules. The provided module must be castable to TrailerModule.

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