Add BP's for foliage meshes to add trigger sounds?

Hey guys,

I need some BP help to add trigger sounds for entering foliage like bushes, grass etc.

Would the best way to make BPs out of the different foliage meshes for adding trigger sounds when passing through a bush for example?

Just have some questions if this is the right way:

  1. First of all, how would I setup this BP? Since I suck pretty much on BP. :slight_smile:

  2. When I set the trigger volume for the bushes, what happens if a mapper scales the sizes on the bushes? Will the trigger volume shape follow the scaling if that happens?

  3. Can I add sounds for entering/passing through in different speeds of moving? Like walk, run, sprint?

Here’s my BP made for one of the bush meshes.
03bbe4f116c8a09eb3a30dad149d3d95a6713368.png
How would I handle large grass fields painted on the maps? If I want moving sounds when passing through large grass fields?

Thx in advance!
/Anders

Anyone? Or this is CIA hacking level? Must be others who would need this aswell. :slight_smile:

Instead of doing it with a bp, you could just use physic materials for it ->
So when the player touches a bush material + moves (plays an animation) it will play a sound (should theoretically work -> havent tested it) :slight_smile:

Just would like to find a way not to manually place all foliage trigger sounds in the maps since there would be so very many. :slight_smile: Everything else seems so smart with BPs. But thx, any help is great. :slight_smile:

You can construct you audio sequence as need per area like long grass that is dense will have a constant scrap/rub lah blah. where medium will not have that quit as much. the art of Foley will play good with your own condense mic or basically ant mic. cooleditpro is good. I think it is cheap but better than audacity.Plus it supports vst`s. Anyway go find you a good filed talk your fone (a good one and record you walkin through). tweek it in an editor and pow you got your own original real stuff. Many objects can be used to simulate other sounds like stick wrapped in clothe and broke in time with a picture of arm bein broke sound size apon arm fingers etc. Then look at you speed in how long it takes to actuall move through the world event and the sound can be streatched to where no alteration is heard.

Considering the age of this thread, this reply is more for anyone else who stumbles onto this from a search engine… I spent a few hours today trying to figure out just how to accomplish this and managed to get it working in a fairly efficient way I think. So the first thing you need to do is make sure that your foliage has collision on the trace channels. Inside the foliage painter, you can set the collision type to block all and then custom. Then check ignore for everything but the two trace channels:

Under the photos I added a permanent link to them on my website in case they ever vanish from here.
FoliageCollision

Image 1

Next, you want to create a custom Physical Material by opening your Project Settings, opening the Physics settings from the link on the left side, and then scrolling down until you get to the Physical Surface section. Under Surface 1 I just gave it the name “Bush” and then create a new Physical Material (Right click in content browser and go to Phyics - Physical Material) called Bush_PhysMat and setting the Physical Material type for your foliage materials to use your new Bush_PhysMat:


Image 2

Then inside your player character BP, create a Set Timer by Function Name node and give it a function name like ScanForBushes. In my case it’s called UpdatePlayerPosition because I’m also using the player location to bend the foliage through a material using World Position Offset (I may post a tutorial on how to set this up later). From that custom event I trigger a “CheckForBushSound” custom event (though if you want you could just run that code from the first event):

Image3

The reason I use a Timer instead of Event Tick is because it’s slightly more efficient and the timing won’t change if your FPS spikes or drops.

It’s inside this “CheckForBushSound” custom event where the magic happens:
(The link has a higher res image for easier readability)


Image 4

All you need to do is create a MultiSphereTraceByChannel (it’s vital to be multi so you can action on every foliage instance immediately) and for each Hit Component, you want to Cast to FoliageInstancedStaticMeshComponent, get the Material, get the PhysicalMaterial and then check to see if it’s equal to your custom Physical material. I also use an AND boolean operation to check to make sure the player is actually moving to prevent the sound effect from spamming if a player stands inside a bush. From there, you simply play your Foliage sound effect at the location of the player through a Do Once that resets after the sound finishes playing (plus a little padding time).

And that’s a rather simple way to implement your Foliage sounds. The nice thing with this system is you can use multiple custom Physical Surfaces/Physical Materials to check for other foliage types like grass, or branches or what have you, and play a different sound for each type, all within the same function.

2 Likes

You could use
://mosthostla/gamedev/dynofoliage

And just add a sound to the replacement blueprint.
I’ll add native support for this in the next update.

Anyway, in the tutorials you can find some info on custom trace channels, which may help if you go with the physical material system.

I made some small changes tell me what you think:

Instead of using equal you could use a select which as index has a surface type of the get physical material, so as to display all the surface types and put the sound you need by type and finally instead of using the actor location for the sound I preferred to use the location of the break hit result

1 Like

Great improvements Snowbeat :slight_smile: Though I’d add an extra bit of padding to the duration of the sound file with a float + float node so that it sounds less spammy. Otherwise you’ll get some foliage movement happening back to back which to be honest sounds worse than if there’s a slight gap of silence between each sound. Unless maybe you remove the gap while running :stuck_out_tongue:

1 Like

Actually also in my script I have added a minimum of delay, I have updated the script so that it detects the speed and based on that it makes a more or less strong sound. (so two selects with a branch based on speed) :slight_smile:

Nice. I actually forgot that I posted this, but just looking at it made me think of all sorts of improvements :slight_smile: You should post the rest of your code with an explanation to share with the community!