it works, BUT in order to hear the clip again I have to release one button and then press another button. When I’m pressing the control buttons (arrows) quicly I hear the clip for milliseconds. I don’t understand what’s going on. Any help???
Mathf.Clamp01 simply does the same thing but automatically clamps between 0 and 1. It is a lot faster to type is all.
rigidbody.velocity is a Vector3. all Vector3s have a magnitude variable, which is the square root of all the x, y and z components squared and then added together.
So if you had a car the speedometer would read car.rigidbody.velocity.magnitude in meters per second.
I 've noticed that the script works almost good without the “Mathf.Clamp01”, sooo if I got it right the clamp01 gives a value to the volume between 0 and 1. Right, huh??
It just seems to work better if the value is “clamped” between 0.7 and 1!!!
thank you very much. I’m really new with JavaScript but with this helpful and supportive forum (and if you have the ideas and know what you want to do), you can improve your skills and knowledge. I feel much more confident now!! Hope I will improve more during the next months. Thanx!
Is the audio sample you are using in .MP3 or .OGG? If so, that might be what is causing the clicking. Try a non-streaming format (like .aif) to see if it goes away.