If I were to do this episode again, I would have a separate and independent spline audio actor that is overlayed on top of the river (matching the shape), but that way if UE5 water is upgraded and breaks stuff, it wouldn't break the river audio. If you know how to make a Spline actor, that is what I would recommend for this episode, rather than converting the UE5 river actor into a blueprint.
I ended up reading this comment before doing this section and this is what I came up with... I made an Actor blueprint and added a WaterSpline to it. This allows me to add spline points to match and follow the UE5 river actor in my level when I drop in the blueprint. ... I then have the construction script filling in four array variables. One for collision spheres, audio components, a play sounds boolean array, and a spline intensity float array. I have the constructor add a collision sphere and audio component at each spline in the water spline of my blueprint. I store these in my respective array variables. I enter false values into all the play sound boolean array elements and I resize the spline intensity float array to the total number of splines in the water spline of my blueprint (this array I set to be instance editable so that I can manually set the volume and pitch intensity at each spline point in the blueprint details panel). Once the constructor is done I have four arrays filled with collision spheres, audio components, booleans, and intensity settings for each spline point I have create on this blueprint. (on a side note make sure and set all audio components auto activate to false or your sound will always be playing you just won't notice it because of attenuation, BTW: this was overlooked a few episodes back and those bird tweeting sounds are always playing regardless of the players location in the world... just attenuation keeps them from being heard, testable with a print string and an isPlaying test off the audio component on those blueprints) With the constructor done I did have to use Event Ticks to make this blueprint work. However, you can set the tick time to be every .5 seconds (or whatever you'd like) instead of every frame so it really doesn't affect performance in any way. This is done in the blueprint details panel under Actor Tick (click on Class Defaults or select the root component in the components list). I used a for each loop to check each collision sphere in my array of collision spheres with a 'get overlapping actors' and another for each loop to test each overlapping actor by 'cast_to_bp_thirdperson' if it hit a third person actor I set the boolean in my boolean array (at the array index of the currently tested sphere) to true. And off the 'Completed' pin of my for each loop that tests the collision sphere array I run a function which uses more for each loops to test the boolean array for true values and play the sound at those audio components from my audio components array (at the corresponding array index... BTW the boolean array, audio array, and sphere array all have the same amount of elements and the indexes all match the correct element for one another). There's a few things that need to be done here for proper playing and stopping of the sounds. Its a matter of using branches to test if an audio component is already playing the sound and if it is don't do anything if its not play the sound. Also if the boolean array value comes back false make sure to send the audio component a 'stop' playing. And make sure to set all the boolean array elements back to false at the end of each tick. It sounds complex but its actually fairly simple once its all set up. And the beauty is you can set the intensity at each spline point to control pitch and volume. And you can create spline points to have a sphere at each point you want along your river and the blueprint constructor will create and manage all the collision sphere, audio components for you. Plus like your comment says this blueprint is completely independent from the UE 5 water system. Its like its own little audio spline. Anyway, it was a great exercise and I have to thank you for suggesting it without showing how its done. It was a lot of fun to sort out and create this thing.
There is (IMO) a better way. Using "Get Closest Point On Collision" function you can get the audio source to attach to the surface of a volume (it has so have simple collisions though), rather than a spline. And it's not that much more computational intensive! You could spawn boxes following the spline and use them as collisions. This, from an audio point of view, is better, since the source of the audio is over an area, and not just over a point 😊
Just a tip... You don't need to keep clicking 'Expose on spawn' for these variables. Expose on Spawn is for when you spawn something into the world at runtime. The variable will be exposed on the Spawn Actor of Class node for you to set there (you might need to right click the node and select 'refresh node' for it to show). For setting variables in the editor before Begin Play, you only need to select 'Instance Editable'.
Really great tutorial man thank you! I messed up the attenuation settings and spent an hour figuring out why I had no sound. To anyone else having no sound play on trigger, make sure you set attenuation Inner Radius to 200 and Falloff to 2800 or something similar!
Maybe it wasn't the case when this video was made but yes, you can get the velocity, depth, or audio intensity at a spline point, using 'get float property at spline point' you just need to know the property name eg AudioIntensity or watervelocityscalar
Thanks for the video. The whole series is great. Disclaimer. I don't know unreal. The following are just random uninformed ideas. I have no idea if this makes any sense for unreal. For the positioning sound problem at 8:20, one could try different ideas: Use Spline Meshes, hide them and use their collision to detect the overlap? Or create a mesh in the editor that conform to the river? Maybe use the unreal modelling tools? Use a cone and deform it with a lattice? Another alternative would be to try to use code (or Blueprints?) to generate the collision given the river spline. I have no idea what that would entails... As for the event tick situation at 20:21, one could just put manually different audio sources along the river. Note that this would be a tiresome solution if the river is very long... Or if the earlier spline trick worked then one advantage is that one could spawn (in the constructor) different audio sources at the spline points of the river. If not enough audio sources, then one can just add more spline points or create interpolated points from the existing ones? For the water velocity problem at 24:30, it seems there is a "get water data at point" that gives the velocity. As seen in this video from the unreal channel th-cam.com/video/7y-ITjcttW8/w-d-xo.html Of course that wouldn't be really a problem if the audio sources are put manually. One can change the sound and maybe give it some clamped random transformations. Another though about the sound when the water velocity is different. At the beginning you used 2 different sounds and mixed them together. Their pitch are very different. One looks like it is from water running more freely than the other. Why not change the mixing proportion depending on the velocity of the water instead of changing the overall sound pitch?
It's a brilliant idea- I think the water velocity isn't exposed to blueprints (I could be wrong), so that's the limiting factor- would have to do it in C++. But if it's exposed to blueprints, that seems to be a great solution, I completely agree
@@NumenBrothers Thanks for the reply. By the way, i mentioned generating the audio sources in the constructor. I think i remember seeing somewhere (i don't know where) that it wasn't a good idea to generate new objects in the blueprint constructor because of poor performance in unreal. Is that a fact? And if so, is there some way to generate them only in the editor, and then somewhat "baking" them to avoid influencing the performance?
Couldnt we add more capsule collisions ? the number would be float just to match number of splines, and start possition would be ending possition of previous one and aiming would be same as this.Maybe its dumb but it seems to be possible(from programming point of view at least). It would be more elegant for twisty mountain streams.
Absolutely. I think if I were building a much longer river (thousands and thousands of units long, for instance), that's exactly what we should do in that case. But in the case of that specific level, the fact that there's only 4 rivers, pretty small space, not particularly twisty rivers, etc., I kept it simple. Also for the demonstration I wanted to keep it as a simple as possible. But I completely agree if I were making longer rivers (and I will be once I start on a main level) that's exactly how I will do it.
@@NumenBrothers Because of my almost 90 degree bending river, I basically copied the blueprint for calculating the capsule and changed the original part to end at the spline midpoint and made that the startpoint for a second capsule to the end point. To get the midpoint of the spline I simply divided the "get number of spline points" by 2 because I knew in my case I would get a round number, but what would happen if the result was an uneven number? Is there an easy way to make sure it's always a round number, example: 14 splines would get 7 but 13 splines would get 6,5 (how to prevent 6,5 spline number as that would never exist?) Sorry for the strange and probably unclear explanation, English is not my first language. Love your tutorial series, learning so much!
@@OpinionatedHuman hi, yes, there is, you can use a concatenate node from the float, or do a float -> integer node to turn it into an integer (which will do the same thing as concatenate). Hope that helps! Feel free to join the Discord if you're still running into trouble.
Such an amazing tutorial. I'm making a vehicle scene where I can drive my mountain truck through a jungle, and this tutorial helped me setting up the river sound effect inside that jungle. Do you have any tutorial covering the real time fluid simulation where water can react to the truck tire and interactable foliage where the leaves moves away from the way upon driving through them ? Thanks
As soon as I tried to optimze from the event tick it began having issues. It seems that my player was never recognized as overlapping the capsule and therefore it did not work as expected.
Nice video but adding overlap events are not the best idea(works like a event tick). Tracing is best for performance. My idea is to sphere trace based on timer ( like 1s or perhaps more) and check if there's a water body river bp and in this case spawn sound....But perhaps i m wrong!
I enabled "Allow tick actions" for that river and now i have sound for the full lengh of my river. my new question is can i use this method for beach and ocean?
Since you can easily get the closest point in the Spline relative to the Player's location, wouldn't it be easier to just get rid of the collider altogether and check if the distance from the Player to the closest point in the Spline < the sound's attenuation distance?
You could, but you would need something that would actually cause the check to occur. Otherwise every single tick you'll be checking to see if the distance from the player to the closest point in the Spline is < the sound's attenuation distance. Hope that makes sense.
So I built everything along, I have my river set up, it looked great and moved into my lake. then I fixed all this sound, the sound is also functioning as intended. BUT NOW my whole river just disappeared after I finished the steps after 22:08 and started testing like you did, I can still hear the river, I just can't see it anymore, what's wrong here?
@@frankyin8509 Yeah I figured this out, It's as Numen says, buggy shitty water from Unreal, I still use it because it looks great and you can do fun things with it, but it does bug out, to fix it you basically just have to drag your whole river (not one splinepoint) 1 unit up or down and it reloads again and shows up. I've had it a bunch of times since my comment here and it was always after changing some landscape somewhere else in my map or whenever I work with layers on my landscape nearby a river.
It is possible that something broke/changed with rivers post 5.0, which is when I recorded this. If I were to do it again, I would have a separate and independent spline audio actor that is overlayed on top of the river (matching the shape), but that way if UE5 water is upgraded and breaks stuff again, it wouldn't break the river audio. If you know how to make a Spline actor, that is what I would do.
If I were to do this episode again, I would have a separate and independent spline audio actor that is overlayed on top of the river (matching the shape), but that way if UE5 water is upgraded and breaks stuff, it wouldn't break the river audio. If you know how to make a Spline actor, that is what I would recommend for this episode, rather than converting the UE5 river actor into a blueprint.
I ended up reading this comment before doing this section and this is what I came up with... I made an Actor blueprint and added a WaterSpline to it. This allows me to add spline points to match and follow the UE5 river actor in my level when I drop in the blueprint. ... I then have the construction script filling in four array variables. One for collision spheres, audio components, a play sounds boolean array, and a spline intensity float array.
I have the constructor add a collision sphere and audio component at each spline in the water spline of my blueprint. I store these in my respective array variables.
I enter false values into all the play sound boolean array elements and I resize the spline intensity float array to the total number of splines in the water spline of my blueprint (this array I set to be instance editable so that I can manually set the volume and pitch intensity at each spline point in the blueprint details panel).
Once the constructor is done I have four arrays filled with collision spheres, audio components, booleans, and intensity settings for each spline point I have create on this blueprint.
(on a side note make sure and set all audio components auto activate to false or your sound will always be playing you just won't notice it because of attenuation, BTW: this was overlooked a few episodes back and those bird tweeting sounds are always playing regardless of the players location in the world... just attenuation keeps them from being heard, testable with a print string and an isPlaying test off the audio component on those blueprints)
With the constructor done I did have to use Event Ticks to make this blueprint work. However, you can set the tick time to be every .5 seconds (or whatever you'd like) instead of every frame so it really doesn't affect performance in any way. This is done in the blueprint details panel under Actor Tick (click on Class Defaults or select the root component in the components list).
I used a for each loop to check each collision sphere in my array of collision spheres with a 'get overlapping actors' and another for each loop to test each overlapping actor by 'cast_to_bp_thirdperson' if it hit a third person actor I set the boolean in my boolean array (at the array index of the currently tested sphere) to true.
And off the 'Completed' pin of my for each loop that tests the collision sphere array I run a function which uses more for each loops to test the boolean array for true values and play the sound at those audio components from my audio components array (at the corresponding array index... BTW the boolean array, audio array, and sphere array all have the same amount of elements and the indexes all match the correct element for one another).
There's a few things that need to be done here for proper playing and stopping of the sounds. Its a matter of using branches to test if an audio component is already playing the sound and if it is don't do anything if its not play the sound. Also if the boolean array value comes back false make sure to send the audio component a 'stop' playing. And make sure to set all the boolean array elements back to false at the end of each tick.
It sounds complex but its actually fairly simple once its all set up. And the beauty is you can set the intensity at each spline point to control pitch and volume. And you can create spline points to have a sphere at each point you want along your river and the blueprint constructor will create and manage all the collision sphere, audio components for you. Plus like your comment says this blueprint is completely independent from the UE 5 water system. Its like its own little audio spline.
Anyway, it was a great exercise and I have to thank you for suggesting it without showing how its done. It was a lot of fun to sort out and create this thing.
@@adsCrazyDiamond Thank you
Can you please make a video showing how to 1. swim in this blueprint successfully, and 2. apply this to other river systems??
There is (IMO) a better way. Using "Get Closest Point On Collision" function you can get the audio source to attach to the surface of a volume (it has so have simple collisions though), rather than a spline. And it's not that much more computational intensive! You could spawn boxes following the spline and use them as collisions. This, from an audio point of view, is better, since the source of the audio is over an area, and not just over a point 😊
Just a tip... You don't need to keep clicking 'Expose on spawn' for these variables. Expose on Spawn is for when you spawn something into the world at runtime. The variable will be exposed on the Spawn Actor of Class node for you to set there (you might need to right click the node and select 'refresh node' for it to show).
For setting variables in the editor before Begin Play, you only need to select 'Instance Editable'.
Really great tutorial man thank you! I messed up the attenuation settings and spent an hour figuring out why I had no sound. To anyone else having no sound play on trigger, make sure you set attenuation Inner Radius to 200 and Falloff to 2800 or something similar!
Maybe it wasn't the case when this video was made but yes, you can get the velocity, depth, or audio intensity at a spline point, using 'get float property at spline point' you just need to know the property name eg AudioIntensity or watervelocityscalar
Extremely useful stuff, thank you so much!
big respect for taking attention to sound detail. Developers overlook the importance of sound design
Thanks for the video. The whole series is great.
Disclaimer. I don't know unreal.
The following are just random uninformed ideas. I have no idea if this makes any sense for unreal.
For the positioning sound problem at 8:20, one could try different ideas:
Use Spline Meshes, hide them and use their collision to detect the overlap?
Or create a mesh in the editor that conform to the river?
Maybe use the unreal modelling tools? Use a cone and deform it with a lattice?
Another alternative would be to try to use code (or Blueprints?) to generate the collision given the river spline. I have no idea what that would entails...
As for the event tick situation at 20:21, one could just put manually different audio sources along the river. Note that this would be a tiresome solution if the river is very long...
Or if the earlier spline trick worked then one advantage is that one could spawn (in the constructor) different audio sources at the spline points of the river.
If not enough audio sources, then one can just add more spline points or create interpolated points from the existing ones?
For the water velocity problem at 24:30, it seems there is a "get water data at point" that gives the velocity. As seen in this video from the unreal channel th-cam.com/video/7y-ITjcttW8/w-d-xo.html
Of course that wouldn't be really a problem if the audio sources are put manually. One can change the sound and maybe give it some clamped random transformations.
Another though about the sound when the water velocity is different. At the beginning you used 2 different sounds and mixed them together. Their pitch are very different. One looks like it is from water running more freely than the other.
Why not change the mixing proportion depending on the velocity of the water instead of changing the overall sound pitch?
It's a brilliant idea- I think the water velocity isn't exposed to blueprints (I could be wrong), so that's the limiting factor- would have to do it in C++. But if it's exposed to blueprints, that seems to be a great solution, I completely agree
@@NumenBrothers Thanks for the reply.
By the way, i mentioned generating the audio sources in the constructor. I think i remember seeing somewhere (i don't know where) that it wasn't a good idea to generate new objects in the blueprint constructor because of poor performance in unreal.
Is that a fact? And if so, is there some way to generate them only in the editor, and then somewhat "baking" them to avoid influencing the performance?
Loving these tutorials!
Couldnt we add more capsule collisions ? the number would be float just to match number of splines, and start possition would be ending possition of previous one and aiming would be same as this.Maybe its dumb but it seems to be possible(from programming point of view at least). It would be more elegant for twisty mountain streams.
Absolutely. I think if I were building a much longer river (thousands and thousands of units long, for instance), that's exactly what we should do in that case. But in the case of that specific level, the fact that there's only 4 rivers, pretty small space, not particularly twisty rivers, etc., I kept it simple. Also for the demonstration I wanted to keep it as a simple as possible. But I completely agree if I were making longer rivers (and I will be once I start on a main level) that's exactly how I will do it.
@@NumenBrothers Because of my almost 90 degree bending river, I basically copied the blueprint for calculating the capsule and changed the original part to end at the spline midpoint and made that the startpoint for a second capsule to the end point.
To get the midpoint of the spline I simply divided the "get number of spline points" by 2 because I knew in my case I would get a round number, but what would happen if the result was an uneven number? Is there an easy way to make sure it's always a round number, example: 14 splines would get 7 but 13 splines would get 6,5 (how to prevent 6,5 spline number as that would never exist?)
Sorry for the strange and probably unclear explanation, English is not my first language. Love your tutorial series, learning so much!
@@OpinionatedHuman hi, yes, there is, you can use a concatenate node from the float, or do a float -> integer node to turn it into an integer (which will do the same thing as concatenate). Hope that helps! Feel free to join the Discord if you're still running into trouble.
@@NumenBrothers Thank you for the reply, joined your Discord as well.
Thanks a lot for making that video ! super useful !
For the challenge I found function "Get Location at Distance Along Spline". That should do the trick.
Such an amazing tutorial. I'm making a vehicle scene where I can drive my mountain truck through a jungle, and this tutorial helped me setting up the river sound effect inside that jungle. Do you have any tutorial covering the real time fluid simulation where water can react to the truck tire and interactable foliage where the leaves moves away from the way upon driving through them ? Thanks
As soon as I tried to optimze from the event tick it began having issues. It seems that my player was never recognized as overlapping the capsule and therefore it did not work as expected.
For those that want crazy precision... take all this math and calculate a capsule for between each node on a for each pair kinda loop
Nice video but adding overlap events are not the best idea(works like a event tick). Tracing is best for performance. My idea is to sphere trace based on timer ( like 1s or perhaps more) and check if there's a water body river bp and in this case spawn sound....But perhaps i m wrong!
You didn’t show how to apply this to multiple rivers
i used it for my whole rivers but one of them (which is the longest one) i only can hear the sound for the half of it
I enabled "Allow tick actions" for that river and now i have sound for the full lengh of my river.
my new question is can i use this method for beach and ocean?
Yes you can. I recommend having a separate spline so in case there are issues changing the blueprint, you don't crash the ocean
Since you can easily get the closest point in the Spline relative to the Player's location, wouldn't it be easier to just get rid of the collider altogether and check if the distance from the Player to the closest point in the Spline < the sound's attenuation distance?
You could, but you would need something that would actually cause the check to occur. Otherwise every single tick you'll be checking to see if the distance from the player to the closest point in the Spline is < the sound's attenuation distance. Hope that makes sense.
So I built everything along, I have my river set up, it looked great and moved into my lake. then I fixed all this sound, the sound is also functioning as intended. BUT NOW my whole river just disappeared after I finished the steps after 22:08 and started testing like you did, I can still hear the river, I just can't see it anymore, what's wrong here?
experimental water. I would save and restart your project at each step, make sure the river is maintained
oh God, same here : (
Weird, after random Ctrl +Z undo certain steps and crashed-restarted, the mesh came to alive again, lol
@@frankyin8509 Yeah I figured this out, It's as Numen says, buggy shitty water from Unreal, I still use it because it looks great and you can do fun things with it, but it does bug out, to fix it you basically just have to drag your whole river (not one splinepoint) 1 unit up or down and it reloads again and shows up. I've had it a bunch of times since my comment here and it was always after changing some landscape somewhere else in my map or whenever I work with layers on my landscape nearby a river.
well followed step by step , 4 TIMES , still have my river playing M in 2D , not from the river , i'm kinda lost
It is possible that something broke/changed with rivers post 5.0, which is when I recorded this. If I were to do it again, I would have a separate and independent spline audio actor that is overlayed on top of the river (matching the shape), but that way if UE5 water is upgraded and breaks stuff again, it wouldn't break the river audio. If you know how to make a Spline actor, that is what I would do.
@@NumenBrothers Oh well , I will try , thanks for the tips !
i did it. if we have 2 diferent rivers we must create bp and for the other river?
Just drag a second river actor into the world (don't need to create two BP's, just have the same BP twice in the world)
Is that your 'married to tech support' ring?
More like Hank Moody
How do u do this with oceans one
Have to make a spline actor to match the shape of the ocean. Will have an episode on that some point in the future.