I’d like to create a realistic soundscape for a physics simulation.
I can play collision sounds when two objects collide, select the sound to play based on the object types and the loudness according to the relative velocity of the objects.
But I would also like to play sounds for objects that slide over a surface. Like a stone that slides over a wooden surface creates a continuous scratching sound.
How could this be achieved using feedback from the physics engine?
If I’m correct you are trying to do something like Penumbra or Amnesia? Either way you can try using OnCollisionStay and play a looping sound when the velocity change, still can create some problems with the other functions you are using for detect impacts.
Another way would be to use raycast from the object itself, casting various short rays in some directions, if they hit a surface and stay still depending on velocity you cna then play the sound. But another problem here as if the object have an eneven shape like a rock you may need to cast many rays to cover all angles.