NWH Vehicle Physics 2
Search Results for

    Show / Hide Table of Contents

    Class ForcedInductionComponent

    Turbocharger or supercharger whine sound. Volume and pitch scale with boost level. Includes spool-up/down inertia.

    Inheritance
    object
    VehicleComponent
    SoundComponent
    ForcedInductionComponent
    Inherited Members
    SoundComponent.baseVolume
    SoundComponent.clips
    SoundComponent.source
    SoundComponent.InitializeWithNoClips
    SoundComponent.Clip
    SoundComponent.InitClip
    SoundComponent.InitVolume
    SoundComponent.InitSpatialBlend
    SoundComponent.InitDopplerLevel
    SoundComponent.InitPlayOnAwake
    SoundComponent.RandomClip
    SoundComponent.HasPlayableClip
    SoundComponent.VC_Initialize()
    SoundComponent.CreateAndRegisterAudioSource(AudioMixerGroup, GameObject)
    SoundComponent.VC_Enable(bool)
    SoundComponent.VC_Disable(bool)
    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 ForcedInductionComponent : SoundComponent

    Fields

    minPitch

    Minimum pitch at low boost (prevents pitch 0 at idle).

    Declaration
    [Range(0, 2)]
    [Tooltip("The starting pitch of the sound when boost is effectively zero but engine is running.")]
    public float minPitch
    Field Value
    Type Description
    float

    pitchCurveExponent

    Shapes the boost-to-pitch curve. The applied exponent is 1 / this value, so 1 is linear, higher values rise early and flatten, lower values hold pitch low then rise steeply.

    Declaration
    [Range(0.5, 3)]
    [Tooltip("Boost-to-pitch curve shape. Applied exponent is 1/value: 1 = linear, higher = rises early then flattens, lower = holds low then rises steeply.")]
    public float pitchCurveExponent
    Field Value
    Type Description
    float

    pitchRange

    Pitch increase based on boost level.

    Declaration
    [Range(0, 5)]
    [Tooltip("Pitch range added to the base pitch depending on the turbo's RPM.")]
    public float pitchRange
    Field Value
    Type Description
    float

    spoolDownSpeed

    Spool-down speed (lower = longer wind-down).

    Declaration
    [Range(0.1, 20)]
    [Tooltip("Simulates the inertia of the turbine slowing down. Lower values mean longer wind-down.")]
    public float spoolDownSpeed
    Field Value
    Type Description
    float

    spoolUpSpeed

    Spool-up speed (higher = more responsive).

    Declaration
    [Range(0.1, 20)]
    [Tooltip("Simulates the inertia of the turbine spooling up.")]
    public float spoolUpSpeed
    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

    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_SetDefaults()

    Writes default values into every serialized field, and may pull default assets from Resources. Runs on vehicle reset and when the component is first added.

    Declaration
    public override void VC_SetDefaults()
    Overrides
    VehicleComponent.VC_SetDefaults()

    VC_Update(float)

    Per-frame update for input, visuals and UI. Only called while the component is active. Physics belongs in VC_FixedUpdate, not here.

    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)
    In this article
    Back to top Copyright © NWH - Vehicle Physics, Aerodynamics, Dynamic Water Physics