Class ExhaustSmoke
Controls particle emitters that represent exhaust smoke based on engine state.
Inherited Members
Namespace: NWH.VehiclePhysics2.Effects
Assembly: NWH.VehiclePhysics2.dll
Syntax
[Serializable]
public class ExhaustSmoke : Effect
Remarks
ExhaustSmoke dynamically adjusts particle system properties (emission rate, size, speed, and color) in response to engine RPM and load. The particle properties scale with engine RPM, while the color transitions between normal exhaust and soot based on throttle input and engine load.
At idle RPM, particles emit at their base values. As RPM increases toward redline, emission rate, particle size, and start speed are multiplied by their respective max multipliers. This creates more intense exhaust effects at higher engine speeds.
Color behavior is load-dependent: light throttle produces light gray smoke (normalColor), while heavy throttle under load produces darker soot (sootColor). The sootIntensity parameter controls how much soot appears when the engine is under load. This simulates rich fuel mixture combustion producing black exhaust smoke during acceleration or high load conditions.
All particle properties lerp smoothly to prevent sudden visual changes. The effect automatically plays/stops particle systems when the engine starts/stops running.
Fields
maxRateMultiplier
Maximum multiplier for particle emission rate at redline RPM. At idle RPM the multiplier is 1.0, scaling linearly to this value at maximum RPM. Higher values produce more particles at high engine speeds.
Declaration
[Range(1, 10)]
[Tooltip("Particle emission rate is multiplied by this value based on engine RPM.")]
public float maxRateMultiplier
Field Value
| Type | Description |
|---|---|
| float |
maxSizeMultiplier
Maximum multiplier for particle start size at redline RPM. At idle RPM the multiplier is 1.0, scaling linearly to this value at maximum RPM. Higher values create larger smoke particles at high engine speeds.
Declaration
[Range(1, 5)]
[Tooltip("Particle start size is multiplied by this value based on engine RPM.")]
public float maxSizeMultiplier
Field Value
| Type | Description |
|---|---|
| float |
maxSpeedMultiplier
Maximum multiplier for particle start speed at redline RPM. At idle RPM the multiplier is 1.0, scaling linearly to this value at maximum RPM. Higher values make particles exit the exhaust faster at high engine speeds.
Declaration
[Range(1, 5)]
[Tooltip("Particle start speed is multiplied by this value based on engine RPM.")]
public float maxSpeedMultiplier
Field Value
| Type | Description |
|---|---|
| float |
normalColor
Normal exhaust smoke color used when the engine is under no load (idle, coasting, light throttle). Typically light gray to represent clean combustion. Lerps toward sootColor when engine load increases.
Declaration
[Tooltip("Normal particle start color. Used when there is no throttle - engine is under no load.")]
public Color normalColor
Field Value
| Type | Description |
|---|---|
| Color |
particleSystems
List of exhaust particle systems.
Declaration
[Tooltip("List of exhaust particle systems.")]
public List<ParticleSystem> particleSystems
Field Value
| Type | Description |
|---|---|
| List<ParticleSystem> |
sootColor
Soot (black smoke) color used when the engine is under heavy load with full throttle. Typically dark gray to black, representing rich fuel mixture combustion that produces carbon particles. Lerped from normalColor based on engine load and sootIntensity.
Declaration
[Tooltip("Soot particle start color. Used under heavy throttle - engine is under load.")]
public Color sootColor
Field Value
| Type | Description |
|---|---|
| Color |
sootIntensity
Controls how much the smoke darkens under engine load. At 0, smoke always uses normalColor regardless of load. At 1, smoke becomes full sootColor at maximum load. Use higher values for diesel engines or older vehicles that produce visible black smoke under acceleration.
Declaration
[Range(0, 1)]
[Tooltip("How much soot is emitted when the throttle is pressed?")]
public float sootIntensity
Field Value
| Type | Description |
|---|---|
| float |
Methods
VC_Disable(bool)
Disables the component and stops updates. Override to add component-specific disable logic.
Declaration
public override bool VC_Disable(bool calledByParent)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | calledByParent | True if called by parent component or LOD system |
Returns
| Type | Description |
|---|---|
| bool | True if successfully disabled, false otherwise |
Overrides
Remarks
Component must be initialized before it can be disabled. Tracks whether disable was called by parent to manage LOD system interaction.
VC_Enable(bool)
Enables the component and starts updates. Override to add component-specific enable logic.
Declaration
public override bool VC_Enable(bool calledByParent)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | calledByParent | True if called by parent component or LOD system |
Returns
| Type | Description |
|---|---|
| bool | True if successfully enabled, false otherwise |
Overrides
Remarks
Will initialize the component if not already initialized. Components disabled by LOD system will track the parent caller to prevent manual enabling while LOD is controlling state.
VC_Initialize()
Initializes the component's internal systems and resources. Called once during vehicle startup after the VehicleController reference is set.
Declaration
protected override void VC_Initialize()
Overrides
Remarks
Override this to set up component-specific resources, cache references, or perform one-time initialization. Sets state.initialized to true on completion.
VC_Update(float)
Frame-rate dependent update called every frame. Override for visual updates and input handling.
Declaration
public override void VC_Update(float DeltaTime)
Parameters
| Type | Name | Description |
|---|---|---|
| float | DeltaTime | Time elapsed since last Update in seconds |
Overrides
Remarks
Only called when the component is active (initialized and enabled). Use for visual effects, UI updates, and other frame-dependent operations. Avoid physics calculations here - use VC_FixedUpdate instead.