NWH Vehicle Physics 2
Search Results for

    Show / Hide Table of Contents

    Class ModuleWrapper

    Abstract MonoBehaviour wrapper that enables module serialization and inspector editing. Since modules themselves are serialized classes that cannot be directly attached as components, this wrapper pattern allows modules to be added to GameObjects and configured in the Unity Inspector. Each module type has its own concrete wrapper implementation that stores and manages the module instance.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    ModuleWrapper
    ABSModuleWrapper
    AerodynamicsModuleWrapper
    AirSteerModuleWrapper
    ArcadeModuleWrapper
    CruiseControlModuleWrapper
    ESCModuleWrapper
    FlipOverModuleWrapper
    FuelModuleWrapper
    MetricsModuleWrapper
    ModuleTemplateWrapper
    MotorcycleModuleWrapper
    NOSModuleWrapper
    RiggingModuleWrapper
    SpeedLimiterModuleWrapper
    TCSModuleWrapper
    TrailerHitchModuleWrapper
    TrailerModuleWrapper
    Namespace: NWH.VehiclePhysics2.Modules
    Assembly: NWH.VehiclePhysics2.dll
    Syntax
    [RequireComponent(typeof(VehicleController))]
    [Serializable]
    [DefaultExecutionOrder(200)]
    public abstract class ModuleWrapper : MonoBehaviour
    Remarks

    To create a custom module:

    1. Create a class deriving from VehicleComponent (your module logic)
    2. Create a wrapper class deriving from ModuleWrapper
    3. Implement GetModule() and SetModule() methods
    4. Add the wrapper component to a VehicleController GameObject

    Methods

    GetModule()

    Returns the module instance managed by this wrapper.

    Declaration
    public abstract VehicleComponent GetModule()
    Returns
    Type Description
    VehicleComponent

    The VehicleComponent module instance.

    SetModule(VehicleComponent)

    Sets the module instance to be managed by this wrapper.

    Declaration
    public abstract void SetModule(VehicleComponent vehicleComponent)
    Parameters
    Type Name Description
    VehicleComponent vehicleComponent

    The VehicleComponent module to assign.

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