- Home /
How to make sounds louder if I go faster
How can I make a sound play when I move. And have it speed up when I go faster.
Your question is confusing, do you want the sound to go faster or louder?
Answer by TeohRIK · Sep 22, 2016 at 01:50 AM
Got a lot of way to do it, but the highest volume for the audio source is 1 only, unless you use audio mixer to further increase the max volume.
If you using audio source, first you need to get your current speed value first, then update the volume on the Audio Source component, but u need to make sure the value is between 0 to 1 float value
Example:
private AudioSource audioSource;
void Start(){
audioSource = GetComponent<AudioSource>();
}
void Update(){
UpdateSound();
}
void UpdateSound(){
audioSource.volume = Mathf.InverseLerp(0f, maxSpeed, currentSpeed);
}
Your answer
Follow this Question
Related Questions
In my 2D platformer game, how would I create a height marker?, 1 Answer
How to check if an object hits the ground hard enough then add explosive force around it (2D) 1 Answer
How can I stop the player movement from being too fast while moving diagonally in my 2D game? 2 Answers
OnTriggerEnter2D doesnt work? 1 Answer