NWH Vehicle Physics 2
Search Results for

    Show / Hide Table of Contents

    Class SpeedLimiterModuleWrapper

    MonoBehaviour wrapper for the SpeedLimiter module.

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

    Enables the SpeedLimiterModule to be attached as a component to a VehicleController GameObject. The wrapper handles Unity's MonoBehaviour lifecycle and serialization while delegating the actual speed limiting logic to the contained module.

    The SpeedLimiter module prevents vehicles from exceeding a configured maximum speed by cutting engine power when the limit is reached. Common uses include speed-restricted vehicles (buses, delivery trucks), racing regulations, or gameplay-driven speed zones.

    Add this component through: - Unity Editor: Add Component > NWH > Vehicle Physics 2 > Modules > Speed Limiter Module - Script: gameObject.AddComponent<SpeedLimiterModuleWrapper>()

    Access the module field at runtime to dynamically adjust speed limits or check the active status for UI feedback.

    Fields

    module

    The SpeedLimiterModule instance managed by this wrapper.

    Declaration
    public SpeedLimiterModule module
    Field Value
    Type Description
    SpeedLimiterModule
    Remarks

    Access this field to configure speed limiting behavior at runtime, such as: - Adjusting the speed limit value dynamically - Changing speed units - Checking the active status for UI indicators

    Example: Implement dynamic speed zones by setting module.speedLimit when entering different areas of your game world.

    Methods

    GetModule()

    Returns the contained SpeedLimiterModule as a VehicleComponent.

    Declaration
    public override VehicleComponent GetModule()
    Returns
    Type Description
    VehicleComponent

    The SpeedLimiterModule instance cast to VehicleComponent.

    Overrides
    ModuleWrapper.GetModule()

    SetModule(VehicleComponent)

    Sets the contained module from a VehicleComponent reference.

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

    The VehicleComponent to set, must be a SpeedLimiterModule instance.

    Overrides
    ModuleWrapper.SetModule(VehicleComponent)
    In this article
    Back to top Copyright © NWH - Vehicle Physics, Aerodynamics, Dynamic Water Physics