Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Car Audio Pitch Without GEAR!

Discussion in 'Editor & General Support' started by EdgarCarrera, Dec 27, 2016.

  1. EdgarCarrera

    EdgarCarrera

    Joined:
    Apr 21, 2014
    Posts:
    255
    Hello guys i need make a engine audio for my car and i have no idea how i can make that can u help me?

    my var

    Thrust
    currentSpeed
    MaxSpeed

    i'm testing this but i didnt like it.

    Code (CSharp):
    1.     public float lowPitchMin = .2f;
    2.     public float lowPitchMax = .8f;
    3. private AudioSource m_HighAccel;
    4.  
    5.     private void LateUpdate() {
    6.         float pitchModifier = lowPitchMax - lowPitchMin;
    7.         m_HighAccel.pitch = lowPitchMin + (kartControl.CurrentSpeed/kartControl.MaxSpeed)*pitchModifier;
     
  2. EdgarCarrera

    EdgarCarrera

    Joined:
    Apr 21, 2014
    Posts:
    255