Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Inverse Proportionality
- TGSP
-
27 posts
Inverse Proportionality
How would I go about making an equation such that the closer the object is? Because if I use distance and volume, the closer the object is, the quieter the sound will be, which is obviously undesirable.
Thanks so Much,
TGSP
Thanks so Much,
TGSP
- blossombreeze
-
500+ posts
Inverse Proportionality
I would suggest trying a script like this:
This will make the sound get louder when the sprite comes closer. (You can change the numbers around until it gets louder at the level you want)
Hope that helps!
This will make the sound get louder when the sprite comes closer. (You can change the numbers around until it gets louder at the level you want)
Hope that helps!
- TGSP
-
27 posts
Inverse Proportionality
Thanks, I was overthinking it and trying to use inverse proportionality.
- -Lite-
-
500+ posts
Inverse Proportionality
v = 100/(sqrt((y1-y2)^2 + (x1-x2)^2)+1)? Thanks, I was overthinking it and trying to use inverse proportionality.
It's not that complicated…
Last edited by -Lite- (May 28, 2017 16:01:23)
- gtoal
-
1000+ posts
Inverse Proportionality
you want the same formula as used for perspective rendering of say a fencepost - the farther away the fencepost is, the shorter its apparent height. So just substitute volume for height and you should be good. How would I go about making an equation such that the closer the object is? Because if I use distance and volume, the closer the object is, the quieter the sound will be, which is obviously undesirable.
Thanks so Much,
TGSP
something like this - obviously you'll have to adapt it to your problem…
- -Lite-
-
500+ posts
Inverse Proportionality
I didn't think of it this way, but, doing it logarithmically makes more senseyou want the same formula as used for perspective rendering of say a fencepost - the farther away the fencepost is, the shorter its apparent height. So just substitute volume for height and you should be good. How would I go about making an equation such that the closer the object is? Because if I use distance and volume, the closer the object is, the quieter the sound will be, which is obviously undesirable.
Thanks so Much,
TGSP
something like this - obviously you'll have to adapt it to your problem…
- Discussion Forums
- » Help with Scripts
-
» Inverse Proportionality