How would one go about adding a sound cue to a projectile so that it plays when its flies past the player. ie bullet whiz etc. I have tried adding my whizzing sound cue as a component in the projectile itself but you can only hear it where the projectile impacts not near the player. I guess I need to trigger it within a certain radius of player in the projectile BP but not quite sure how to go about it.
thanks for any help.
Sorry to bump but it’s been a while
I have no idea if this is how to do it properly, but you could attach a non-rendered sphere to the player’s head and detect when bullets pass through it, then play the sound. That method also makes it easy to visualize the distance that the player would hear whiz-bys.
Hey thanks for the reply. Interesting idea.
Would you mind elaborating a little on what I’d put in my charBP?
I drag the sphere component into the CharBP event graph and add a play sound, I guess I need to cast to my projectile too? Sorry but what other nodes do I need to detect the overlap?
I really have no idea. I’m a newbie with the engine and I’m not an engineer. My suggestion just seemed like an intuitive way to go about doing it. Let us know what you find out!
I’d just put in a sphere collision primitive as a BP component, dig through its collision properties to allow everything to pass through it but allow for touch events with the projectile. Then just catch the touch events. Sorry, I can’t give you any more details than that cause I haven’t tried it myself.
I would try the “Play Sound Attached” node added to the projectile on begin play. The sound file itself will probably want to be looping, but it will definitely HAVE to be mono and absolutely NOT stereo (doesn’t work in 3D space). You can then adjust the attenuation settings to have it only audible from a certain radius. Nothing else should be required.
No worries JiggleToes, I’ll keep at it and try to keep this updated if I find a solution. Thanks for the extra info too, i need to work out how to catch a touch event.
Thanks Hitpaws,
that’s actually what I have currently but the main issue I find with it is the projectile is so fast that you only hear a minuscule part of the sample. You don’t get the benefit of the full flyby recording. An arrow flyby sound for example https://vimeo.com/musicstore/track/205434/arrow-fly-by-06-by-audiosocket
You only hear a very short pft, if that much. So I think it’s best to trigger the full sound somehow
I think I’d like to give Jiggly’s idea a try, would you perhaps know what nodes I’d need to use?
I tried this in the ProjectilesBP but no luck. I cast to the character from the projectile, check for an overlap of the collision sphere, if true, print string.
put a delay on your sound. i dont know how to do this in unreal, but if you have audacity (free) you can just simply move the sound a little bit to the right on the player so that it doesnt start playing until maybe 0,5 seconds into its playback. and then you put this sound to spawn on attached (projectile). after this, if u want to, u can put attenuation on the sound so that only those in the radius of the flyby can hear it.
a trouble with this on the other hand is what happens if the bullet impacts on something and the sound stops playing. it can sound very weird. i think a possible solution is to have sound attached on the impact material. if the projectile hits a metal object, then the sound of the metal can blend and “cover up” the abrupt ending of the flyby whizz sound. but im not sure. im trying to puzzle this.
In case anyone is still looking for a solution for this, here is how I went about it.
Inside my projectileBP I put a collision sphere that would trail behind the forward movement of the projectile and the bullet collision sphere. I made the trailing collision sphere larger to the scale where I would want players to hear a whizz sound as a bullet passes by.
If the bullets collision sphere hits a player or other surface the trailing collision sphere would never get a chance to fire as the bullet would be destroyed. On the begin overlap of the trailing sphere I simply tested if it was a player by checking which interface the actor was using then spawned a sound at the bullet location.
i know this was 4 years ago, but i tried what @JigglyToes said, and basically i got my character and placed a collision sphere around him, and the enemy which shoot at the player, and i did on component begin overlap cast to your projectile your enemy is shooting, then you play your bullet whiz sound. So every time that projectile overlaps that sphere it will play the sound you could also add a delay to slow it down so it wont pile up.