NWH Vehicle Physics 2
Search Results for

    Show / Hide Table of Contents

    Namespace NWH.VehiclePhysics2.GroundDetection

    Classes

    GroundDetection

    Detects surface type under each wheel using tags (priority), terrain splatmaps, or fallback. Applies per-surface friction presets, rolling resistance, and visual/audio effects. Runs via coroutine at groundDetectionInterval. Tracks dominantSurfacePreset across all wheels. While disabled every wheel sits on the fallback surface, so nothing latches the last detected one.

    GroundDetectionPreset

    Shared ground detection configuration for vehicles. This ScriptableObject contains SurfaceMaps that map terrain textures and object tags to surface types, plus particle prefabs and fallback settings.

    Share this preset across vehicles to avoid configuring ground detection on each one. Typically one preset is created per scene or project, though multiple presets can be used for different vehicle types or environments.

    The preset manages:

    • Surface detection mappings (terrain textures and object tags to surface properties)
    • Particle effect prefabs for dust/smoke and surface chunks
    • Fallback surface preset for unmatched surfaces
    • Shared configuration across multiple vehicles

    Create via: Right-click in Project window > Create > NWH > Vehicle Physics 2 > Ground Detection Preset

    Essential setup:

    1. Assign a fallback surface preset (required)
    2. Configure surface maps for terrain textures and object tags
    3. Set up particle prefabs for visual effects (optional)
    4. Assign to vehicle's GroundDetection component

    Workflow:

    • Create one or more SurfacePresets defining properties for each surface type
    • Create SurfaceMaps to link terrain textures/tags to those presets
    • Assign this preset to vehicles that should use these surface definitions

    SurfaceMap

    Maps a surface type to its detection rules: terrain texture indices and/or object tags. A SurfacePreset defines the properties for the matched surface.

    Each SurfaceMap represents a unique surface type in your scene and specifies:

    • Which terrain texture indices should be treated as this surface type
    • Which object tags should be treated as this surface type
    • The SurfacePreset that defines friction, visual effects, and audio for this surface

    Ground detection checks tags before terrain textures. This allows objects (roads, bridges, ramps) to override terrain textures beneath them.

    Usage scenarios:

    • Map terrain texture 0 (grass) to a grass SurfacePreset
    • Map object tag "Road" to an asphalt SurfacePreset
    • Map multiple terrain textures (dirt variations) to the same dirt SurfacePreset
    • Override terrain with tagged objects for special surface areas

    If both lists are empty, this surface map will never be matched.

    SurfacePreset

    ScriptableObject defining a surface type's friction, particles, skidmarks, and audio. Applied to wheels via SurfaceMaps based on terrain texture or object tag. FrictionPreset assignment is required for proper grip - everything else is optional. Create via: Right-click > Create > NWH > Vehicle Physics 2 > Surface Preset

    Enums

    SurfacePreset.ParticleType

    Determines particle emission behavior.

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