2012-03-26

Play sounds when walking

I know this has been done before and done so many times before -- goodness knows Miss Vila owned enough pairs of shoes and boots that made footstep noises, and I might have at least one pair of pony boots in my inventory that do the same. ;)

But, anyway, after having been asked a scripting question this last weekend and not knowing the answer right off, I couldn't resist having a think and a read. I found the answer and, in doing so, realised that it was easy to write a script that plays a sound when an avatar is walking. Which means I could finally make myself a subtle barefoot walking sound thing.

Which I did this morning.

This script is the result of my experimenting and I offer it here in case it's useful to anyone else. Just create a prim and drop this script in, along with the sound you want to play. Attach the prim to yourself (either as a HUD, or to some part of your body -- I've got it attached to my right foot, and made invisible) and you should be good to go.

This probably isn't the most elegant way of doing this. It probably isn't the most efficient either. But it was a fun experiment and it seems to work just fine.

No comments:

Post a Comment