NWH Vehicle Physics 2
Search Results for

    Show / Hide Table of Contents

    Vehicle Controller

    VehicleController inspector

    Main controller component that coordinates all vehicle systems. Attach this to your vehicle's root GameObject.

    Architecture

    Component-based system where each subsystem (powertrain, effects, sound, etc.) can be enabled/disabled independently. Uses StateSettings for LOD configuration.

    Core Systems

    Powertrain

    Engine, clutch, transmission, differentials, and wheels. See Powertrain.

    Control

    Steering, brakes, and input handling.

    Effects & Sound

    Skidmarks, particles, lights, exhaust effects, and audio system.

    Modules

    Optional systems: ABS, TCS, ESC, Aerodynamics, Fuel, NOS, Trailer, etc. See ModuleManager.

    Requirements

    • Rigidbody (added automatically)
    • WheelController 3D components on child objects

    Physics Settings

    Fixed Timestep: 0.01667 (60Hz) desktop, 0.02-0.03 mobile Solver: TGS recommended Rigidbody:

    • Mass: 1000-2000 kg (cars), 3000-10000 kg (trucks)
    • Drag: 0
    • Angular Drag: 0.05
    • Interpolation: Interpolate

    Properties

    Dimensions

    dimensions - Vehicle size (Width × Height × Length) in meters. Affects inertia calculations.

    Position References

    • enginePosition - For audio/effects
    • exhaustPosition - For particles/sound
    • transmissionPosition - For transmission audio

    Thresholds

    • lateralSlipThreshold (0.15) - Lateral slip threshold for effects
    • longitudinalSlipThreshold (0.3) - Longitudinal slip threshold for effects

    LOD

    • multiplayerInstanceType - "Local" for player vehicle, "Remote" for others
    • lodCamera - Camera for LOD distance checks (uses Camera.main if null)

    State System

    StateSettings ScriptableObject controls which components are active at each LOD level. See State Settings and LOD.

    Update Order

    Each frame:

    1. Update() - Input, state updates
    2. FixedUpdate() - Ground detection → Input → Powertrain → Steering → Brakes → Modules → Effects
    3. LateUpdate() - Visual updates (wheel models)

    Component Lifecycle

    All components inherit from VehicleComponent:

    • VC_Initialize() - Setup
    • VC_SetDefaults() - Default config
    • VC_Validate() - Validation
    • VC_Enable() / VC_Disable() - State changes
    • VC_Update() / VC_FixedUpdate() - Updates

    Events

    • onLODChanged - LOD level changed
    • onWake / onSleep - Rigidbody state
    • onEnable / onDisable - Component state

    Setup

    Use Tools > NWH > Vehicle Physics 2 > Vehicle Setup Wizard for automatic configuration, or see Quick Start Guide.

    Performance

    • LOD system for distant vehicles
    • Component pooling for effects/sounds
    • Disable unused modules
    • Increase Fixed Timestep on mobile (0.02-0.03)

    Common Issues

    Unstable physics: Lower Fixed Timestep, check center of mass, verify wheel/suspension settings

    Poor performance: Enable LOD, reduce modules, check Fixed Timestep

    No input: Check Input Provider assignment, verify vehicle is awake

    See FAQ for more.

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