The 2nd half of my post got clipped. Here it is.
For objects that are in constant contact with one another, and I have plenty as every scene in my game has dozens of stacked rocks, is another story. I use the same delay implemented above, but I also take into account object velocity and collision force. It’s getting better as I tweak, but it’s kind of painstaking.
Has anyone solved this problem?
function Resources.playRockCollisionSound(snd, force, velocity, threshold) local factor = force\*velocity print("CRASH = " .. tostring(math.floor(factor\*10)/10)) if factor \< threshold then print("CRASH NO SOUND") return end local volume = 0 local chan = 0 if factor \>= threshold\*3 then chan = LOUDEST\_ROCK\_CHANNEL print("CRASH LOUDEST") volume = 0.5 elseif factor \>= threshold\*2 then chan = LOUD\_ROCK\_CHANNEL print("CRASH LOUD") volume = 0.4 elseif factor \>= threshold\*1.5 then chan = NORMAL\_ROCK\_CHANNEL print("CRASH NORMAL") volume = 0.3 elseif factor \>= threshold\*1.25 then chan = QUIET\_ROCK\_CHANNEL print("CRASH QUIET") volume = 0.2 elseif factor \>= threshold then chan = QUIETEST\_ROCK\_CHANNEL print("CRASH QUIETEST") volume = 0.1 end local options = { channel = chan } audio.setVolume(volume, options) playSound(snd, options) end