NWH Vehicle Physics 2
Search Results for

    Show / Hide Table of Contents

    Class EngineRunningComponent

    Granular engine audio synthesis using AudioMixer. Crossfades multiple RPM samples and controls mixer effects (lowpass, distortion, reverb).

    Inheritance
    object
    VehicleComponent
    SoundComponent
    EngineRunningComponent
    Inherited Members
    SoundComponent.baseVolume
    SoundComponent.clips
    SoundComponent.source
    SoundComponent.Clip
    SoundComponent.InitClip
    SoundComponent.InitVolume
    SoundComponent.InitSpatialBlend
    SoundComponent.InitDopplerLevel
    SoundComponent.InitPlayOnAwake
    SoundComponent.RandomClip
    SoundComponent.VC_Initialize()
    SoundComponent.CreateAndRegisterAudioSource(AudioMixerGroup, GameObject)
    SoundComponent.PlayRandomClip()
    SoundComponent.PlayForDurationCoroutine(int, float)
    SoundComponent.Play()
    SoundComponent.Play(int)
    SoundComponent.SetPitch(float)
    SoundComponent.SetVolume(float)
    SoundComponent.Stop()
    SoundComponent.AddDefaultClip(string)
    VehicleComponent.state
    VehicleComponent.vehicleController
    VehicleComponent.IsActive
    VehicleComponent.VC_Initialize(VehicleController)
    VehicleComponent.VC_FixedUpdate(float)
    VehicleComponent.VC_LoadStateFromStateSettings()
    VehicleComponent.VC_DrawGizmos()
    VehicleComponent.VC_Validate(VehicleController)
    VehicleComponent.UpdateLOD()
    VehicleComponent.ToggleState()
    Namespace: NWH.VehiclePhysics2.Sound.SoundComponents
    Assembly: NWH.VehiclePhysics2.dll
    Syntax
    [Serializable]
    public class EngineRunningComponent : SoundComponent

    Fields

    crossfadeCurve

    Volume falloff curve for crossfading between RPM samples.

    Declaration
    public AnimationCurve crossfadeCurve
    Field Value
    Type Description
    AnimationCurve

    dopplerLevel

    Doppler amount applied to the granular engine sources.

    Declaration
    public float dopplerLevel
    Field Value
    Type Description
    float

    engineSamples

    RPM-based audio samples for granular synthesis.

    Declaration
    public List<EngineRunningComponent.EngineSample> engineSamples
    Field Value
    Type Description
    List<EngineRunningComponent.EngineSample>

    loadLowPassBoost

    Additional lowpass frequency (Hz) added when engine is under load.

    Declaration
    public float loadLowPassBoost
    Field Value
    Type Description
    float

    loadPitchBias

    Pitch increase when engine is under load.

    Declaration
    public float loadPitchBias
    Field Value
    Type Description
    float

    loadVolumeBias

    Volume reduction when engine is unloaded (coasting).

    Declaration
    public float loadVolumeBias
    Field Value
    Type Description
    float

    loadVolumeBoostDB

    Volume swing in dB between coasting and full load, below the ceiling.

    Declaration
    public float loadVolumeBoostDB
    Field Value
    Type Description
    float

    maxDistortion

    Maximum distortion level (0-1) at full load.

    Declaration
    public float maxDistortion
    Field Value
    Type Description
    float

    maxLowPass

    Lowpass filter frequency at max RPM (Hz).

    Declaration
    public float maxLowPass
    Field Value
    Type Description
    float

    maxPitch

    Upper bound for sample playback pitch.

    Declaration
    public float maxPitch
    Field Value
    Type Description
    float

    maxReverbDB

    Reverb level in dB when coasting (wet).

    Declaration
    public float maxReverbDB
    Field Value
    Type Description
    float

    maxVolumeDB

    Engine mixer volume ceiling in dB. Volume swells up to this and never exceeds it.

    Declaration
    public float maxVolumeDB
    Field Value
    Type Description
    float

    minLowPass

    Lowpass filter frequency at idle RPM (Hz).

    Declaration
    public float minLowPass
    Field Value
    Type Description
    float

    minPitch

    Lower bound for sample playback pitch.

    Declaration
    public float minPitch
    Field Value
    Type Description
    float

    minReverbDB

    Reverb level in dB when under load (dry).

    Declaration
    public float minReverbDB
    Field Value
    Type Description
    float

    mixerDistortionParam

    AudioMixer exposed parameter name for distortion level.

    Declaration
    public string mixerDistortionParam
    Field Value
    Type Description
    string

    mixerLowPassParam

    AudioMixer exposed parameter name for lowpass filter frequency.

    Declaration
    public string mixerLowPassParam
    Field Value
    Type Description
    string

    mixerReverbParam

    AudioMixer exposed parameter name for reverb mix.

    Declaration
    public string mixerReverbParam
    Field Value
    Type Description
    string

    mixerVolumeParam

    AudioMixer exposed parameter name for volume control.

    Declaration
    public string mixerVolumeParam
    Field Value
    Type Description
    string

    rpmVolumeBoostDB

    Volume swing in dB between idle and max RPM, below the ceiling.

    Declaration
    public float rpmVolumeBoostDB
    Field Value
    Type Description
    float

    smoothing

    SmoothDamp time for RPM and Load transitions.

    Declaration
    public float smoothing
    Field Value
    Type Description
    float

    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
    SoundComponent.AudioMixerGroup

    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
    SoundComponent.ContainerGO

    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
    SoundComponent.InitLoop

    InitializeWithNoClips

    Gets whether this component can be initialized without any audio clips assigned. Most components require at least one clip to function.

    Declaration
    public override bool InitializeWithNoClips { get; }
    Property Value
    Type Description
    bool
    Overrides
    SoundComponent.InitializeWithNoClips

    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
    SoundComponent.Priority

    Methods

    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
    SoundComponent.VC_Disable(bool)

    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
    SoundComponent.VC_Enable(bool)

    VC_SetDefaults()

    Resets the component to default configuration. Override to provide component-specific default values.

    Declaration
    public override void VC_SetDefaults()
    Overrides
    VehicleComponent.VC_SetDefaults()
    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.

    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
    VehicleComponent.VC_Update(float)
    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.

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