NWH Vehicle Physics 2
Search Results for

    Show / Hide Table of Contents

    Ground Detection

    GroundDetection inspector.

    Determines which WheelFrictionPreset, effects, and sounds apply to each wheel based on surface type.

    v13.1+ Changes

    No layer setup required. Detection priority:

    1. GameObject tags (highest)
    2. Terrain texture splatmaps
    3. Fallback surface preset

    Configuration centralized in GroundDetectionPreset ScriptableObject.

    Ground Detection Preset

    Contains:

    • Surface Maps (texture indices/tags → SurfacePreset)
    • Fallback surface
    • Particle prefabs

    Create: Right-click > Create > NWH > Vehicle Physics 2 > Ground Detection Preset

    Surface Maps

    Each entry defines:

    • Terrain texture indices (0-based, matches Terrain Layer order)
    • GameObject tags
    • SurfacePreset reference (friction, sound, effects)

    Performance

    Checks one wheel per update cycle. Configure groundDetectionInterval:

    • 0.05s - responsive (player vehicle)
    • 0.1s - balanced (default)
    • 0.2s - low CPU (AI)

    Surface change detection depends on interval and wheel count.

    Dominant Surface

    Tracks which surface has most wheels in contact. Used for vehicle-wide effects (engine sounds, etc).

    Setup

    Basic

    1. Create or assign GroundDetectionPreset to VehicleController
    2. Configure Surface Maps:
      • Terrain: Note texture order in Terrain Layers, assign indices
      • Objects: Tag objects, assign tags to Surface Maps
    3. Link each Surface Map to appropriate SurfacePreset

    For Terrains

    Texture index = order in Terrain Layers (first = 0, second = 1, etc.)

    For Objects

    Tag objects with surface type ("Asphalt", "Concrete", etc.), match tags in Surface Maps.

    Troubleshooting

    Wrong surface detected: Check texture indices match Terrain Layer order, verify GameObject tags match Surface Map tags

    Delayed changes: Reduce groundDetectionInterval, note design checks one wheel per cycle

    No effects/sounds: Verify SurfacePreset has clips/prefabs, check EffectManager/SoundManager enabled

    Technical Notes

    • No raycasting (uses contact point sampling)
    • Thread-safe
    • Supports multiple terrains
    • Per-wheel surface assignment
    • Dominant surface cached
    In this article
    Back to top Copyright © NWH - Vehicle Physics, Aerodynamics, Dynamic Water Physics