# Playing sounds on object collision without sound repeating itself

So i am trying to make sounds playing correctly in my game. I am using “Event Hit” to tell my program when the sound should be played. Currently i am using this for basic sound playing on collision

This system usually works, but sometimes sound starts repeating itself. Mostly this happens with fully rounded meshes that are rolling on floor. In this game, player can throw balls and i need to add sound when it hits the objects / floor. This system isn’t working so great with it because this only measures that is the velocity over 10. It works pretty good with cubes because they don’t start rolling even if they are hit.

Anybody come up with a better solution that works with rounded objects?

1 Like

So I am understanding correctly that the ball is playing the sound while it’s rolling on the floor? If so, you may want to try breaking the vectorlength into its x,y, z components (break Vector node) and write something that says if the ball’s velocity in the Y direction is > 0, play the sound.

I’m in a similar situation on a project I’m working on where there are lots of objects the player can put down on or throw against different objects and surfaces, and they need to throw sounds. I’m curious, are you adding this sound logic to every BP for an object the player can throw to play a sound?

About the spheres or sphere-like shapes that can roll over longer distances and trigger the “hit” event all the time: I had this problem, too.

Solved this now after hours of testing. It’s actually a problem that is quite easy to solve: Have a variable “Last Velocity”. On Hit, check if Length of the Vector “Current Linear Velocity - Last Velocity” is bigger than a threshold (50 worked for me), if yes then set the Last Velocity variable to current velocity and play the sound.

The idea behind it: Hit events where you want to play the impact sound generally occur with a sudden & significant change in velocity.

Here the part of the blueprint for this check:

Hope this helps!

2 Likes

Yea but when do you decide to reset it? I tried this resetting the value when velocity was near 0 but didn’t work well.

Thanks for the tips !