How to generate sounds on collision of a thrown physics object?

Hi there,

I have a system where I can pick up and throw objects. I’m trying to make it so an impact sound would play when the thrown object hits a wall for example, but alas no luck so far.

I tried checking if the player character (where the picking up and throwing blueprint is) still recognizes the thrown actor as a component, but when I do an OnComponentHit, nothing fires from the node. However the thrown object collides and bounces off the wall as normal.

Simulate Hit Events is on for both the actor being thrown and the wall I’m throwing it against as well.

Is there a specific way or do this somewhere else, or am I missing something?
All feedback is highly appreciated.

Thanks!

Can you show some of your Blueprint, are the thrown objects a seperate BP class or are they components of your player class?

If they are a seperate class, if you put an EventHit in your thrown object class, plus a print string, does it print?

It’s all in my player class blueprint. Also the thrown objects aren’t apart of a class, they’re just static mesh that my player can pick up through simulated physics.

I could show blueprint, but it’s just a generic grab and release component, with an Add Impulse node to throw objects.

This should get you started. I presume you are doing a trace to get the mesh to pick up, bind an event to OnActorHit, by dragging off from Hit Component and typing “Assign on component hit”

The branch on the normal impulse is there is because you don’t want to sound to play for very small sliding hits, you will get 100s of the sound playing at the same time. You will have to play around with the value there, I have 700000 in mine.

Too low and too many impact sounds will play, too high and only high velocity direct impacts will cause sound. You could also add a concurrency setting so that you can control the max amount of impact sounds playing at one time.

Yo thanks man highly appreciated!
For people in the future if they see this, you may want to lower the more than value from 700k. For me I have it set to 100.

Thanks a bunch again Mosel3y!

Would be nice to see a solution for a full physical based sound environment. The solution above only adds the sound to the thrown object as i understand. Would be nice to see a bigger solution so every element which has impacts makes sounds. It’s need quiet complex algorithm, not to have too much sounds simultaneously when many items are moving, and only play sound on certain level of impact force which have to by calculated.

I actually think this could be fairly easily implemented with physical materials and an array. Just repeat function above and add different sound effects at different “force” values.