Looking to find where/how to attach collision sounds to static mesh/objects

Hi Unreal community,

Here’s what I’m looking to do:

Find the place/file where I can assign collision sounds & a threshold to static objects/meshes. For example, If I’m riding around in a golf cart and run over or bump into a trash can, or maybe some rocks, etc. I’m looking to attach the sound to the trash can’s collision. I would expect this to be based on the impact force where I can set a threshold and assign different sounds based on the force the collision system is outputting. Can anyone help me with this?

Thanks,

StaticMesh Event > OnComponentHit > Break Hit result

Thanks! I found the OnComponentHit event, and Break Hit Result function but I"m still not sure how to hook these up. Do you have any tips?

https://docs.unrealengine./latest/INT/BlueprintAPI/Collision/BreakHitResult/index.html

You can Google the term also, there should be plenty of tutorials that implement it.

Thank you! Much appreciated!

Does anyone have an idea of why the sound is NOT playing when colliding with this static mesh component? I’ve created & specified a socket for the sound to emit from. Am I missing something basic here?

Thanks!

Off the top of my head, two things. Did you put what sound you want to make? And second, does the mesh have collision? Check the Static Mesh Editor.

Yep the mesh has collision and it’s set to “collision creates hit event” checked. I’m not sure what you mean by “Did you put what sound you want to make”. I have an audio component that I’ve set up in the mesh. I’m not sure if I should be playing the sound from the audio component (get socket name) or use “Play sound at location” instead.

:slight_smile: Ok, I think I understand your mistake. Or either that, or I have no idea what I’m talking about :wink:

So, you see how you called that Play Sound At Location node? I saw it blank, and I am assuming it’s still blank. That node needs a input reference (Sound in this case) to play. It’s blank. Since there’s no sound reference there, it won’t play anything.

What you thought you were doing was calling that sound from the socket location, but instead you were merely setting the locations of which it would be playing. So, usually, when you break Hit Result, you would merry up location and location, so that when you hit a particular area, it would play the sound at that location.

So, to fix your problem. Input the sound you want to play, then keep the socket location (since I guess that’s where you want the sound to only play at)

The only thing is, I’ve only played briefly around with sockets, so not entirely too sure it it will play the sound where you want, but without trying your setup yourself, I can’t think of why it just wouldn’t work as I’ve explained above.

It’s funny, I’ve tried assigning a sound in the “play sound at location” node, and the sound never was heard. Then, I tried adding an audio component, then targeted the socket, still nothing. I’m running out of ideas. : (

An easier way could be just set up a trigger box/sphere surrounding you’re object that you want to play the sound then just use the on actor overlap node then play sound at location.

Also from you’re screenshots the break hit node isn’t connected to anything . Shouldn’t this be connected to the mesh or target in some way??

Thanks for your input! If I were to use a box trigger is it possible to attach the box trigger to the mesh? If so that may work, otherwise I would have to create a box trigger for every instance of the mesh (in this case there are hundreds of them).

The OnComponentHit event is an event from the mesh.

is this what you are trying to do??

so lets say you have an asset in you’re content browser , in you’re case its a trash can . you want to make a blueprint attached to the trash can that when you put it into the world and something hits it , then it will play a sound??
if so mine worked. Here is what i did.

so just right click the chosen asset in the content browser and go to create blueprint using this actor.

Then inside the blueprint events right click and add the onComponent hit event

then set it up like this. Drag a reference to the static mesh into the event graph

oyOWJKN.png

Then drag a pin out from the reference and create a get socket location node. in the socket name write the name of you’re socket. in my case this is test

YrY3dtt.png

make sure the names are spelt exactly as they are in the socket manager

then just plug the return value into the location value on the play sound at location nodule. so you’re finished blueprint will look like this

qPIdigH.png

One final thing on the play sound at location nodule . click the drop down box shown by the arrow and select you’re sound that you want to play. in my case i used the default editor sound called compileFailed

here is a demo project with it all working . just take the cube blueprint drop it in the scene multiple times and then run into it with the character and the sound will play.

https://www.dropbox./s/3mop09w1nl8a8gr/Sound%20test%20project.zip?dl=0

let me know if this helps thanks

is this what you are trying to do??

so lets say you have an asset in you’re content browser , in you’re case its a trash can . you want to make a blueprint attached to the trash can that when you put it into the world and something hits it , then it will play a sound??
if so mine worked. Here is what i did.

so just right click the chosen asset in the content browser and go to create blueprint using this actor.

Then inside the blueprint events right click and add the onComponent hit event

then set it up like this. Drag a reference to the static mesh into the event graph

oyOWJKN.png

Then drag a pin out from the reference and create a get socket location node. in the socket name write the name of you’re socket. in my case this is test

YrY3dtt.png

make sure the names are spelt exactly as they are in the socket manager

then just plug the return value into the location value on the play sound at location nodule. so you’re finished blueprint will look like this

qPIdigH.png

One final thing on the play sound at location nodule . click the drop down box shown by the arrow and select you’re sound that you want to play. in my case i used the default editor sound called compileFailed

here is a demo project with it all working . just take the cube blueprint drop it in the scene multiple times and then run into it with the character and the sound will play.

https://www.dropbox./s/3mop09w1nl8a8gr/Sound%20test%20project.zip?dl=0

let me know if this helps thanks
[/QUOTE]

First of all, THANK YOU for taking the time to help with this. Unfortunately this is still not working. Would it make a difference if the object (static mesh) has it’s own blueprint class? That’s what I’ve been working from. I also made a new blueprint based off the mesh, but do I need to add that blueprint somewhere or attach it to anything? Also, I have clicked (and tried it when unclicked) the "“Simulation Generates Hit Event”. Still nothing.

You need to take screenshots of every piece of BPs you have/want implemented. We’ve given you a few choices as to how to get this working, but I think you may be trying to do something that isn’t possible or just doing it incorrectly. We need the full information to help you out.

Put a breakpoint and/or some print strings in your blueprint so you can see if the overlap/hit events are actually firing off at all. Narrow down where the problem is actually occurring and you will have a much easier time debugging the problem.

I don’t understand how it can’t be working. All you have to do is follow my screenshots . The item can be anything a rock , a trash can (you’re case) or a cube (what I done in the example)

Did you even download my project?? If you did you would see it working exactly as I have done in the screen shots .

The blueprint is all set up in the content browser. I drag the blueprint into the scene this spawns my object into the world . I can do this as many times as I want let’s say I wanted 10 trash cans in my case the cube I just drag the blueprint into the scene 10 times an position them where I want.

Then hit play . I can run to any of the 10 cubes and no matter which one I hit it will play the sound.

I could clone the blueprint then just change the mesh from a cube into any static mesh I want . Drop it into the scene and it will still work.

So I’m confused. If you have followed my blueprints exactly then yours should work.

TBH, I don’t understand why he’s trying to do it in the custom socket location in the first place. Just use the point of impact as the location source. Since the point of impact of the golf cart and trash can is would it where the sound would be made.

But if he had to do it for whatever reason at the socket location, it should be working as intended with the help he’s been given.

Please post the blueprints of what you’ve implemented OP so we can figure out what’s going on.

is this what you are trying to do??

so lets say you have an asset in you’re content browser , in you’re case its a trash can . you want to make a blueprint attached to the trash can that when you put it into the world and something hits it , then it will play a sound??
if so mine worked. Here is what i did.

so just right click the chosen asset in the content browser and go to create blueprint using this actor.

Then inside the blueprint events right click and add the onComponent hit event

then set it up like this. Drag a reference to the static mesh into the event graph

oyOWJKN.png

Then drag a pin out from the reference and create a get socket location node. in the socket name write the name of you’re socket. in my case this is test

YrY3dtt.png

make sure the names are spelt exactly as they are in the socket manager

then just plug the return value into the location value on the play sound at location nodule. so you’re finished blueprint will look like this

qPIdigH.png

One final thing on the play sound at location nodule . click the drop down box shown by the arrow and select you’re sound that you want to play. in my case i used the default editor sound called compileFailed

here is a demo project with it all working . just take the cube blueprint drop it in the scene multiple times and then run into it with the character and the sound will play.

https://www.dropbox./s/3mop09w1nl8a8gr/Sound%20test%20project.zip?dl=0

let me know if this helps thanks
[/QUOTE]

So this seems like exactly like mine is set up, the only difference is there is a vehicle involved in the collision (as opposed to a character). Also in your project (for some reason) I was unable to locate the socket you created on the mesh, but no matter, the sound does work and is heard in your example project (Thank you for doing/sending that).
Another difference between your setup and mine is that the BP for the trashcan has already been created, so I’m using that, as opposed to creating cube and starting fresh. I can’t tell any differences between our setups though, otherwise. I even noticed that you do not have “Collision generates hit events” checked, which seems odd but it’s working for you.

It may be something with the vehicle blueprint because I can’t think of any possible thing wrong with my set up.

I guess I’ll keep looking into it on the vehicle side.

Thanks again. Much appreciated.

This thread helped me a lot, thank you. I’m sure you got this working by now @craft_media_group. I also have a vehicle set up (hitting rocks in a field). And one thing I had to adjust was the min radius on the attenuation of the soundcue. When you add a socket to a staticmesh it gets placed in the objects origin (which can be farther away from the objects collision area). So my camera (in the vehicle) was farther than the units I had on the soundcue.

I also had to turn on Simulation Generates Hits Event in the Collision details.