Class ExhaustPopComponent
Exhaust popping and backfire sound. Triggered during deceleration, gear shifts, or when hitting rev limiter.
Inherited Members
Namespace: NWH.VehiclePhysics2.Sound.SoundComponents
Assembly: NWH.VehiclePhysics2.dll
Syntax
[Serializable]
public class ExhaustPopComponent : SoundComponent
Fields
decelerationPopChanceCoeff
Multiplier for pop frequency during deceleration (throttle off, RPM > 40%).
Declaration
[Tooltip("The number of pops under deceleration.")]
public float decelerationPopChanceCoeff
Field Value
| Type | Description |
|---|---|
| float |
minPopInterval
Minimum time in seconds between consecutive pops, across all trigger sources.
Declaration
[Tooltip("Minimum seconds between pops, shared by every trigger (deceleration, shift, rev limiter). The rev limiter re-arms each cutoff cycle, so without a floor holding throttle on the limiter sprays a continuous burble. Default 0.25 caps the rate at ~4/s while keeping crackle.")]
public float minPopInterval
Field Value
| Type | Description |
|---|---|
| float |
popChance
Probability of pop per trigger event (0.1 = 10% chance).
Declaration
[Tooltip("Each time there is an exhaust flash or rev limiter is hit, what is the chance of exhaust pop?")]
public float popChance
Field Value
| Type | Description |
|---|---|
| float |
popOnDeceleration
Enable random pops during deceleration (throttle off, RPM > 40%).
Declaration
[Tooltip("Should pops happen randomly when the vehicle is decelerating with the throttle released?")]
public bool popOnDeceleration
Field Value
| Type | Description |
|---|---|
| bool |
popOnShift
Enable pops during gear shifts.
Declaration
[Tooltip("Should pops happen when the transmission shifts gears under load?")]
public bool popOnShift
Field Value
| Type | Description |
|---|---|
| bool |
popSource
Event that triggers pops (ExhaustFlash or RevLimiter).
Declaration
[Tooltip("The source for the pop trigger. \r\nIf ExhaustFlash is selected, ExhaustFlash effect needs to be set up for this to work.")]
public ExhaustPopComponent.PopSource popSource
Field Value
| Type | Description |
|---|---|
| ExhaustPopComponent.PopSource |
Properties
AudioMixerGroup
Gets the Audio Mixer Group this component's AudioSource should output to. Used to route audio through the vehicle's audio mixer for processing and mixing.
Declaration
public override AudioMixerGroup AudioMixerGroup { get; }
Property Value
| Type | Description |
|---|---|
| AudioMixerGroup |
Overrides
ContainerGO
Gets the GameObject container where the AudioSource should be created. Used to position audio sources at specific locations on the vehicle.
Declaration
public override GameObject ContainerGO { get; }
Property Value
| Type | Description |
|---|---|
| GameObject |
Overrides
InitLoop
Gets whether the AudioSource should loop continuously. Override in derived classes to enable looping for continuous sounds like engine running.
Declaration
public override bool InitLoop { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Overrides
Priority
Gets the priority level for the AudioSource. Lower values indicate higher priority. Range is 0 (highest) to 256 (lowest). Used by Unity's audio system when the maximum number of audio sources is reached.
Declaration
public override int Priority { get; }
Property Value
| Type | Description |
|---|---|
| int |
Overrides
Methods
Pop()
Plays an exhaust pop with randomized volume and pitch.
Declaration
public void Pop()
VC_Disable(bool)
Stops and disables the AudioSource belonging to this SoundComponent.
Declaration
public override bool VC_Disable(bool calledByParent)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | calledByParent |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
VC_Enable(bool)
Enables the AudioSource belonging to this SoundComponent.
Declaration
public override bool VC_Enable(bool calledByParent)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | calledByParent |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
VC_FixedUpdate(float)
Physics update called at fixed intervals. Override to implement physics-based behavior.
Declaration
public override void VC_FixedUpdate(float DeltaTime)
Parameters
| Type | Name | Description |
|---|---|---|
| float | DeltaTime | Time elapsed since last FixedUpdate in seconds |
Overrides
Remarks
Only called when the component is active (initialized and enabled). Use for physics calculations, force application, and other fixed-timestep operations. Called from VehicleController.FixedUpdate().
VC_SetDefaults()
Resets the component to default configuration. Override to provide component-specific default values.
Declaration
public override void VC_SetDefaults()
Overrides
Remarks
Called when the vehicle is reset or when first added to a GameObject. Should set all serialized fields to sensible default values. May load default assets from Resources folder.