NWH Vehicle Physics 2
Search Results for

    Show / Hide Table of Contents

    Mirror

    NWH Vehicle Physics 2 multiplayer setup with Mirror.

    Requirements

    • Mirror networking package installed
    • Vehicle already set up for single-player

    Install Mirror first. The sample compiles only when Mirror is present (its asmdef is gated on the MIRROR define, which Mirror sets automatically). Import the sample before installing Mirror and MirrorMultiplayerVehicle won't appear.

    Import Sample

    1. Open Package Manager (Window > Package Manager)
    2. Select "NWH Vehicle Physics 2" from the list
    3. Navigate to the Samples tab
    4. Import "Multiplayer Mirror Sample"

    Scene Setup

    Create a NetworkManager GameObject:

    • Add NetworkManager component
    • Add NetworkManagerHUD component (for testing)
    • Add KcpTransport component (or other transport)

    Vehicle Setup

    1. Add MirrorMultiplayerVehicle component to your vehicle
      • This automatically adds required NetworkIdentity component
    2. Add ONE physics sync component:
      • NetworkTransformReliable - syncs position/rotation only
      • NetworkRigidbodyReliable - syncs full physics state (recommended)
    3. Save vehicle as prefab
    4. Assign prefab to NetworkManager's Player Prefab field

    How It Works

    MirrorMultiplayerVehicle synchronizes vehicle state at 20Hz:

    • Inputs (steering, throttle, clutch, handbrake)
    • Gear shifts
    • Light states
    • Engine RPM

    Physics (position/rotation/velocity) are handled by Mirror's NetworkTransform/NetworkRigidbody components.

    Works in both dedicated server and host+client modes.

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