- Home /
Car acceleration sound ,Car accelerating engine sound script
I'm trying to find a script for car sounds and nothing worked.
I tried this last one... I put it in CarController script.
public float topSpeed = 100; private float currentSpeed = 0; private float pitch = 0;
void Update () { currentSpeed = transform.GetComponent().velocity.magnitude * 3.6f; pitch = currentSpeed / topSpeed;
transform.GetComponent <AudioSource> ().Pitch = pitch;
}
and unity says:
'AudioSource' does not contain a definition for 'Pitch' and no accessible extension method 'Pitch' accepting a first argument of type 'AudioSource' could be found (are you missing a using directive or an assembly reference?)
if any other scripts are better please help,
thanks...
Your answer
Follow this Question
Related Questions
How to reach a specific max speed with AddForce() ? 1 Answer
Car Accelerate Over Time. (JavaScript and RigidBody) 2 Answers
how do i gradually speed up a car 1 Answer
Someone used fmod? 0 Answers
AudioClip[] bug 1 Answer