NWH Vehicle Physics 2
Search Results for

    Show / Hide Table of Contents

    Vehicle Setup Wizard

    Vehicle Setup Wizard

    Automates vehicle setup from a 3D model by creating all required components and configuring vehicle-type-specific parameters.

    Requirements

    • Model root with scale [1,1,1] (use import scale instead)
    • At least one collider on vehicle body
    • Separate wheel GameObjects
    • Scene mode only (does not work in prefab mode)

    Setup Process

    The wizard uses a two-stage process:

    1. RunSetup() - Creates core components:

      • Rigidbody with interpolation
      • VehicleController with default settings
      • WheelController per wheel with StandardFriction
      • Wheel radius/width auto-detected from mesh bounds
      • Optional: Camera with CameraMouseDrag and CameraChanger
      • Optional: Character enter/exit points (left/right)
    2. RunConfiguration() - Applies VehicleSetupWizardPreset settings:

      • Physical properties: mass, inertia tensor
      • Powertrain: engine power/RPM, transmission gearing, drivetrain (FWD/AWD/RWD)
      • Suspension: travel distance, stiffness
      • Vehicle-specific tuning (sound clips, differential settings, modules)

    Vehicle Types

    Presets support these vehicle types:

    • Car - Balanced handling, standard gearing
    • SportsCar - High power, forced induction, limited-slip differential, 7-speed
    • OffRoad - Longer suspension travel, locked differential
    • MonsterTruck - Extreme suspension travel
    • SemiTruck - Heavy mass, high power, 18-speed transmission
    • Trailer - Unpowered, trailer-specific state settings
    • Motorcycle - Two wheels, narrow tires, MotorcycleModule added

    Usage

    Editor

    1. Attach VehicleSetupWizard to vehicle root GameObject
    2. Select a VehicleSetupWizardPreset (or create via Assets > Create > NWH > Vehicle Physics 2)
    3. Add wheel GameObjects in order: front-left, front-right, rear-left, rear-right (or front, rear for motorcycle)
    4. Adjust width/height/length for dimensions
    5. Click "Run Setup"

    Scripting

    VehicleController vc = VehicleSetupWizard.RunSetup(
        vehicleRoot, wheelGameObjects,
        addCamera: true, addCharacterEnterExitPoints: true,
        width: 1.8f, height: 1.5f, length: 4.5f);
    
    VehicleSetupWizard.RunConfiguration(vc, preset);
    

    Notes

    • Wizard should be considered a starting point, not a complete setup
    • Wheel GameObjects are parented to WheelController's rotating container
    • Input providers must be added separately to scene (e.g., InputSystemVehicleInputProvider)
    • Default drivetrain is AWD (can be changed via preset)
    In this article
    Back to top Copyright © NWH - Vehicle Physics, Aerodynamics, Dynamic Water Physics