Answer the question
In order to leave comments, you need to log in
Unity how to make the audiosourse pitch smoothly increase when moving, and also decrease when stopped?
The character (vehicle) moves like this:
void FixedUpdate()
{
float v = Input.GetAxis("Vertical");
float h = Input.GetAxis("Horizontal");
body.AddForce(transform.right * tankSpeed * v, ForceMode2D.Impulse);
body.AddTorque(tankRotationSpeed * h * -Mathf.Sign(v), ForceMode2D.Impulse);
}
Answer the question
In order to leave comments, you need to log in
Got it. I just found the numerical value of the speed (speed = body.velocity.magnitude) and got currentPith = defaultPitch + speed /100.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question