• News

• Industries

• Learning & Support

• Community

• Marketplace

# Can anyone help me with this?

I need to be able to find a way to trigger the sound effect ball bounce every time the ball hits an object. When the ball falls and hits the ground the sound gets stuck in an infinite loop where it plays the 1st milliseconds of the sound over and over. I have to use a unbind all events blueprint to stop the loop but it then doesn’t play any sound on the second bounce. At first I used the below BP

Then someone gave me this answer.

"In a project of ours we use a combination of the max play count and checking the normal impulse. Get the length of that vector and print it. Test at which minimum you want to have the sound played and do a simple branch.

That way it will only trigger the sound when the object hits the ground with enough force which is exactly what we wanted. And prevents silly infinite loops when it’s almost not moving anymore as well."

The only problem is I’m not sure what he means because there are gaps in his explanation and he hasn’t either looked at my thread again or is not going to answer at all. He doesn’t explain how you “Get the length of that vector and print it” my guess is in the pic below. Also he doesn’t explain what “Test at which minimum you want to have the sound played and do a simple branch” means. Can anyone here figure out what the gaps are. If I could then I wouldn’t be having this problem in the 1st place. Thanks.

the reason the sound gets looped is because it hits permanently the ground. make a check whether last location is current location in this case he shouldnt play the sound.

Thanks for your answer but that doesn’t help me and just to save time let me explain why. I’m going to use an example of something I know how to do. Say I wanted to understand how to turn on the Physics on a ball. If someone said to me

“You need to set it up so your main actor can control the input of the ball then setup a main event to turn that on or off”

That wouldn’t help me. I wouldn’t know where to start. However if someone said

You need to create an actor BP put the ball in a static mesh in the BP Turn off physics, then in this BP from an “event begin play” drag off and set an “enable input”. From the “player controller” in this enable input drag off “get player controller” This will allow you to control the ball. Then in the same BP create a key event choose the keyboard “Z” key then from that drag off and set a “Set simulate Physics” node and the ball should already be attached.

That would because it would outline the steps I would need to take when I’m doing something for the 1st time. When you say “make a check whether last location is current location” I’ve never done that before so can you either explain in detail what I need to do or show an example BP also would this still work when the ball is rolling along the ground? Wouldn’t it just repeat the bounce sound as it rolled along every second or so?

so you want people to chew your food? you cant expect people to do all the work i can give you hints but my time is limited. you have 118 posts so i thought you know how to save a vector and compare it with another vector.
youre right, when it rolls it would also play the sound. thats why you should compare the distance between the vectors and if its lets say 2 cm appart its allowed to play a sound again. or just compare it additional with the Z axis. if the z axis doesnt change but the rest does, its clearly rolling and doesnt need a sound beeing played
also inside of sound cues there are some options that prevent sound spam maybe you should also look into this.

Wow that was completely unhelpful. If I wanted to spend all my night guessing at hints I’d play an uncharted game. Your answer is actually more unhelpful than no answer at all. I have been tearing my hair out for the last few days trying to fix this issue and I come to a place where I hope the people will be nice and kind enough to give me the help I need but instead I came back to this.

“so you want people to chew your food? you cant expect people to do all the work :)”

No I don’t want people to chew my food for me or for them to do all the work. All I expect is if someone tells me what needs to be done, for them to at the very least tell me how to do it.

i was kind enough to spend time on your problem. if you want to ***** around because you dont understand simple ue4 ****, then its your problem and not mine.
"at the very least tell me how to do it. ", which i did. youre welcome.
have fun getting answers here with this attitude.

No you are far from kind. You made the insulting comment “so you want people to chew your food?” to someone who was just looking for help. That sums your character completely. Please leave this thread for someone that actually wants to try and help me without being a smart@ss.

Ok so I got the answer I was looking for from the 1st guy I asked. Many thanks to him. After the last few posts in this thread he might not want me giving him a shout out here lol but I’ll explain the solution for anyone else that would like to have a similar sound effect in their project.

Plug the wire from your vector length into the “In String” entry of the “Print String” node. When you play your scene and drop the ball to the floor in the top left corner you will see a number flash up very briefly when the ball bounces. Make a note of this number. A moment later when the ball is resting on the ground (This is where the problem is occurring because the blue print doesn’t know when to end the sound so the start gets stuck in a loop.) you will see another number. You can then pull out the wire from the impact normal vector length again and search for “>” and pick the one that compares two float values (by default the first one when context sensitive is turned on). Take a look at the below BP

In the “>” node make sure the number you put in is above the number you got when the ball is resting on the ground and below the number you get when it bounces. You can see in mine I put 10 but the number you see might be wildly different because I have the weight of my ball set very low. The great thing about this BP is that it can be used on so many different types of situations from glass breaking to a cup falling off a table.

Edit: I used the mesh itself for the event hit if you are using a capsule then make sure to set the capsule to be slightly larger than the mesh or be sure to turn off collision of your mesh.