Class 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
Namespace: NWH.VehiclePhysics2.GroundDetection
Assembly: NWH.VehiclePhysics2.dll
Syntax
[Serializable]
[CreateAssetMenu(fileName = "NWH Vehicle Physics 2", menuName = "NWH/Vehicle Physics 2/Surface Preset", order = 1)]
public class SurfacePreset : ScriptableObject
Fields
chunkLifeDistance
Max distance chunks can travel from the wheel before despawning. 2-3m: subtle, 3-5m: moderate (default), 5-10m: dramatic.
Declaration
[Tooltip("Determines maximum distance from the wheel that the chunk can stay alive.")]
public float chunkLifeDistance
Field Value
| Type | Description |
|---|---|
| float |
drawSkidmarks
Draw skidmarks on this surface. Disable for water, loose sand, grass where marks wouldn't show.
Declaration
[Tooltip("Should skid/thread marks be drawn on this surface?")]
public bool drawSkidmarks
Field Value
| Type | Description |
|---|---|
| bool |
emitChunks
Emit debris chunks behind wheels. For loose surfaces (gravel, dirt, sand) only. Requires chunkPrefab in GroundDetectionPreset.
Declaration
[Tooltip("Should dirt chunks / stones be thrown behind the wheel on this surface type?")]
public bool emitChunks
Field Value
| Type | Description |
|---|---|
| bool |
emitParticles
Emit dust/smoke particles. Smoke (hard surfaces) emits on slip; dust (loose) emits on speed. Requires particlePrefab in GroundDetectionPreset.
Declaration
[Tooltip("Should the particles be emitted on this surface type?")]
public bool emitParticles
Field Value
| Type | Description |
|---|---|
| bool |
frictionPreset
WC3D friction preset defining grip characteristics. Required for proper handling. Dry asphalt: peak ~1.0-1.2. Gravel: ~0.6-0.8. Sand: ~0.4-0.6. Ice: ~0.2-0.4.
Declaration
[Tooltip("Friction preset of WC3D that will be used for this surface. More presets can be added in WheelController.FrictionPresets.")]
public FrictionPreset frictionPreset
Field Value
| Type | Description |
|---|---|
| FrictionPreset |
maxChunkEmissionRateOverDistance
Chunks emitted per distance traveled. 0.5-1: sparse, 1-2: moderate (default: 1), 2-5: heavy.
Declaration
[Tooltip("Maximum number of chunks emitted over distance.")]
public float maxChunkEmissionRateOverDistance
Field Value
| Type | Description |
|---|---|
| float |
maxChunkLifetime
Chunk lifetime in seconds. 0.3-0.5s: brief, 0.5-1s: moderate (default: 0.5), 1-2s: dramatic.
Declaration
[FormerlySerializedAs("maxChunkLifeTime")]
[Tooltip("Maximum lifetime of an emitted chunk.")]
public float maxChunkLifetime
Field Value
| Type | Description |
|---|---|
| float |
maxParticleEmissionRateOverDistance
Particles emitted per distance. 0.1-0.2: subtle, 0.2-0.4: moderate (default: 0.36), 0.4-2: heavy.
Declaration
[Range(0, 2)]
[Tooltip("Maximum number of particles emitted over distance.")]
public float maxParticleEmissionRateOverDistance
Field Value
| Type | Description |
|---|---|
| float |
maxParticleLifetime
Particle lifetime in seconds. 1-2s: brief, 2-4s: moderate (default: 3.5), 4-8s: long-lasting. Longer lifetimes = more active particles = higher performance cost.
Declaration
[Tooltip("Maximum particle start lifetime.")]
public float maxParticleLifetime
Field Value
| Type | Description |
|---|---|
| float |
name
Display name for this preset. Shows in editor, debug logs, and runtime detection.
Declaration
[Tooltip("Name of the surface preset.")]
public string name
Field Value
| Type | Description |
|---|---|
| string |
particleColor
Particle color matching the surface material. Examples: dark gray for asphalt smoke, brown for dirt dust, yellow/tan for sand, white for snow.
Declaration
[FormerlySerializedAs("dustColor")]
[Tooltip("Color of generated particles on this surface type.")]
public Color particleColor
Field Value
| Type | Description |
|---|---|
| Color |
particleLifeDistance
Max particle travel distance from vehicle. 5-10m: localized, 10-20m: moderate (default: 10), 20-50m: wide.
Declaration
[Tooltip("Maximum distance from the vehicle a particle can achieve.")]
public float particleLifeDistance
Field Value
| Type | Description |
|---|---|
| float |
particleMaxAlpha
Particle opacity at spawn. 0.3-0.5: translucent, 0.5-0.8: moderate (default: 0.8), 0.8-1: opaque.
Declaration
[Range(0, 1)]
[Tooltip("Maximum alpha value start color of an emitted particle can achieve.")]
public float particleMaxAlpha
Field Value
| Type | Description |
|---|---|
| float |
particleSize
Particle size multiplier. 0.5-1: fine, 1-2: standard (default: 1), 2-5: large. Scale based on vehicle size and camera distance.
Declaration
[Tooltip("Initial size of the emitted particles.")]
public float particleSize
Field Value
| Type | Description |
|---|---|
| float |
particleType
Smoke: emits on wheel slip only (hard surfaces like asphalt, concrete). Dust: emits based on speed (loose surfaces like dirt, sand, gravel, snow).
Declaration
[Tooltip("Type of particles generated.\r\n- Smoke - depends on wheel slip. Use for hard surfaces. Will not emit when there is no wheel slip.\r\n- Dust - depends on speed only. Use for dusty surfaces, e.g. gravel or sand.")]
public SurfacePreset.ParticleType particleType
Field Value
| Type | Description |
|---|---|
| SurfacePreset.ParticleType |
playSkidSounds
Play skid sounds when wheels slip. Disable for soft surfaces like grass/sand. Volume scales with slip intensity.
Declaration
[Tooltip("Should tire skid sounds be played for this surface type?")]
public bool playSkidSounds
Field Value
| Type | Description |
|---|---|
| bool |
playSurfaceSounds
Play rolling sounds when moving on this surface. Use slipSensitiveSurfaceSound to control whether volume depends on slip or just speed.
Declaration
[Tooltip("Should a tire rolling over the surface sound be played for this surface type?")]
public bool playSurfaceSounds
Field Value
| Type | Description |
|---|---|
| bool |
rollingResistanceMaxMultiplier
Rolling resistance multiplier based on tire load. 1 = firm (asphalt), 2-5 = soft (grass/dirt), 10-20 = very soft (deep sand/mud), 20-50 = extremely soft (swamp). Higher values = more drag.
Declaration
[Range(1, 50)]
[Tooltip("Multiplies the rolling resistance of the WheelController by this value based on the load on the tire.\r\nUseful for surfaces such as sand where the wheel digs into the material.")]
public float rollingResistanceMaxMultiplier
Field Value
| Type | Description |
|---|---|
| float |
skidSoundClip
Skid sound clip - tire squeal for asphalt, grinding for gravel, muffled for dirt, etc. Volume modulated by slip intensity.
Declaration
[Tooltip("AudioClip used for wheel skidding sound effect.")]
public AudioClip skidSoundClip
Field Value
| Type | Description |
|---|---|
| AudioClip |
skidSoundPitch
Skid sound pitch. 0.7-0.9: deeper (soft surfaces), 0.9-1.1: normal, 1.1-1.3: higher (hard surfaces).
Declaration
[Tooltip("Sound pitch of wheel skidding over the surface.")]
public float skidSoundPitch
Field Value
| Type | Description |
|---|---|
| float |
skidSoundVolume
Skid sound volume. 0.1-0.2: quiet (grass/sand), 0.2-0.4: moderate (default: 0.3), 0.4-1: loud (asphalt).
Declaration
[Tooltip("Sound volume of the wheel skidding over the surface.")]
public float skidSoundVolume
Field Value
| Type | Description |
|---|---|
| float |
skidmarkBaseIntensity
Skidmark visibility when not slipping - tire impressions from just rolling. 0 = only shows marks when skidding (asphalt). 0.1-0.3 = faint tracks (packed dirt). 0.4-0.7 = clear impressions (mud, wet sand). 0.8-1 = deep tracks (fresh snow).
Declaration
[FormerlySerializedAs("baseIntensity")]
[Range(0, 1)]
[Tooltip("Intensity of the skidmarks when there is no wheel slip.\r\nSet to 0 for hard surfaces and >0 for soft surfaces where the tire leaves the mark by rolling over it.")]
public float skidmarkBaseIntensity
Field Value
| Type | Description |
|---|---|
| float |
skidmarkMaterial
Skidmark material matching the surface - black for asphalt, brown for dirt, etc. Should use transparency for natural blending with ground.
Declaration
[Tooltip("Material used for skid/thread marks on this type of surface.")]
public Material skidmarkMaterial
Field Value
| Type | Description |
|---|---|
| Material |
slipFactor
How responsive slip-based effects (skidmarks, smoke) are to wheel slip. 0-0.3: low sensitivity, 0.3-0.6: moderate (default: 0.5), 0.6-1: high sensitivity.
Declaration
[Range(0, 1)]
[Tooltip("Factor that influences slip-based effects for this surface.")]
public float slipFactor
Field Value
| Type | Description |
|---|---|
| float |
slipSensitiveSurfaceSound
When true, rolling sound volume increases with wheel slip (for hard surfaces like asphalt). When false, volume depends on speed only (for soft surfaces like dirt, gravel, grass).
Declaration
[FormerlySerializedAs("slipSensitiveSound")]
[Tooltip("If set to true surface volume will be dependent on slip (asphalt, concrete, etc.). Set to false for dirt, grass and other soft surfaces.")]
public bool slipSensitiveSurfaceSound
Field Value
| Type | Description |
|---|---|
| bool |
surfaceSoundClip
Rolling sound clip - tire hum for asphalt, crunching for gravel, rustling for grass, etc.
Declaration
[Tooltip("AudioClip used for wheel rolling sound effect.")]
public AudioClip surfaceSoundClip
Field Value
| Type | Description |
|---|---|
| AudioClip |
surfaceSoundPitch
Rolling sound pitch. 0.7-0.9: rough surfaces, 0.9-1.1: normal (default: 1), 1.1-1.3: smooth surfaces.
Declaration
[Tooltip("Sound pitch of the wheel rolling over the surface.")]
public float surfaceSoundPitch
Field Value
| Type | Description |
|---|---|
| float |
surfaceSoundVolume
Rolling sound volume. 0.1-0.2: quiet (smooth asphalt), 0.2-0.4: moderate (default: 0.3), 0.4-1: loud (gravel).
Declaration
[Tooltip("Sound volume of the wheel rolling over the surface.")]
public float surfaceSoundVolume
Field Value
| Type | Description |
|---|---|
| float |