Doing strafe-run sounds and echo sounds

What’s one of the best implementations of doing echo sounds for when planes fly by or at a distance?

I know one of the ways for you to implement echo sounds is to have a server script fire a function to the clients and determine if they’re at a distance for them to have a sound cloned and parted near a character, but I’m kinda clueless to determine how to do so when a plane flies over you (like in some games where a plane overs your character and it plays a sonic-boom like sound if it’s going at high speed.) It’s one of those problems I’m having a hard time trying to diagnose without heavily affecting performances.

4 Likes

Instead of firing to all clients to check, you can do it a slightly easier way.

You could create a single part underneath the plane which is transparent, can-collide false and massless. Then, weld the part to the underside of the plane.

Then, have a touched event on the part which detects if a player has touched it. If it has, then you fire the client event to play a sonic boom sound locally.

Would this solve your issue?

1 Like

I feel like the touched event is a bit of a weird method. The way I did it for arrows was I just ran a loop in a local script to check if the arrow is within range, and as soon as it was I played a swoosh sound that was inside of the arrow. Thus it worked out pretty well.

1 Like

Hmmm. Instead of parts could you use a Region3 for this? Just check if the player is inside of the region every few seconds and then fire the remote?

1 Like

Nah, Region3 is a pretty expensive calculation. You can just simply check if the plane is within a certain distance of the camera. Like local dist = (Camera.CFrame.p - Plane.Position).magnitude

1 Like

Ah ok. You got me.

So you essentially find the length of a vector from the camera to the plane?

1 Like

Yes, and when that distance is short enough you play the sound thats inside of the plane. I would probably play it as soon the distance is less than the Sound.MaxDistance value since you wouldn’t hear the sound any further than that anyways.

4 Likes